Skip to content

Flush Clickhouse buffers faster by encoding early - #3623

Merged
aerosol merged 5 commits into
plausible:masterfrom
ruslandoga:encode-early
Dec 14, 2023
Merged

aerosol merged 5 commits into
plausible:masterfrom
ruslandoga:encode-early

Conversation

@ruslandoga

@ruslandoga ruslandoga commented Dec 13, 2023 •

Copy link
Copy Markdown
Contributor

Changes

This PR retries #3511, but with the session insert order fixed.

I'm keeping it in draft until #3622 is merged

Tests

Changelog

  • Entry has been added to changelog

Documentation

Dark mode

  • This PR does not change the UI

@ruslandoga
ruslandoga marked this pull request as draft December 13, 2023 06:35
if found_session do
updated_session = update_session(found_session, event)
buffer.insert([%{updated_session | sign: 1}, %{found_session | sign: -1}])
buffer.insert([%{found_session | sign: -1}, %{updated_session | sign: 1}])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix.

CacheStore.on_event(event1, nil, buffer)
CacheStore.on_event(event2, nil, buffer)
assert_receive({WriteBuffer, :insert, [[session, _negative_record]]})
assert_receive({WriteBuffer, :insert, [[_negative_record, session]]})

@ruslandoga ruslandoga Dec 13, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests use a mock buffer so they had to be updated due to the fix mentioned above.

Comment thread CHANGELOG.md Outdated
- Show Outbound Links / File Downloads / 404 Pages / Cloaked Links instead of Goal Conversions when filtering by the corresponding goal
- Require custom properties to be explicitly added from Site Settings > Custom Properties in order for them to show up on the dashboard
- GA/SC sections moved to new settings: Integrations
- `CLICKHOUSE_MAX_BUFFER_SIZE` now represents bytes and defaults to `100000` (100KB)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename it to CLICKHOUSE_MAX_BUFFER_SIZE_BYTES so I can keep both in our deployment scripts? Makes it easier to revert and later on we can deprecate the old one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thanks!

@aerosol aerosol changed the title encode early Flush Clickhouse buffers faster by encoding early Dec 13, 2023
@ruslandoga
ruslandoga marked this pull request as ready for review December 14, 2023 05:18
@aerosol
aerosol merged commit 6639d6a into plausible:master Dec 14, 2023
aerosol added a commit that referenced this pull request Dec 18, 2023
@ruslandoga
ruslandoga deleted the encode-early branch June 10, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants