Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Benchmark ingestion #132

Merged
merged 12 commits into from
Feb 11, 2021
Merged

Benchmark ingestion #132

merged 12 commits into from
Feb 11, 2021

Conversation

mariusandra
Copy link
Collaborator

Changes

  • New version of Ingestion and e2e benchmarks #122 (to avoid a bad merge)
  • Adds a simple "ingestion only" benchmark (measures await processEvent)
  • Adds Kafka & Celery E2E ingestion benchmarks (from "posthog.capture" to event in postgres or clickhouse)
  • The E2E benchmarks run one simple sync plugin and then add the result to the database. Benchmarks for plugins that e.g. wait for 20sec before doing anything will look wildly different and should be tested next
  • Also adds some scripts to package.json to wipe the local kafka/clickhouse/zookeeper docker images

Results on my 16" 2.4GHz i9 MBP for the E2E benchmarks with 4 workers:

    [Celery & Postgres] Ingested 3000 events in 6.94s (432.18 events/sec, 2.31ms per event)
    [Celery & Postgres] Ingested 3000 events in 7.09s (423.41 events/sec, 2.36ms per event)
    [Celery & Postgres] Ingested 10000 events in 26.09s (383.24 events/sec, 2.61ms per event)
    [Celery & Postgres] Ingested 10000 events in 26.04s (384.08 events/sec, 2.6ms per event)

    [Kafka & ClickHouse] Ingested 3000 events in 25.62s (117.09 events/sec, 8.54ms per event)
    [Kafka & ClickHouse] Ingested 3000 events in 20.68s (145.06 events/sec, 6.89ms per event)
    [Kafka & ClickHouse] Ingested 3000 events in 19.85s (151.13 events/sec, 6.62ms per event)
    [Kafka & ClickHouse] Ingested 3000 events in 21.00s (142.83 events/sec, 7.00ms per event)
    [Kafka & ClickHouse] Ingested 10000 events in 143.94s (69.47 events/sec, 14.39ms per event)
    [Kafka & ClickHouse] Ingested 10000 events in 136.75s (73.12 events/sec, 13.68ms per event)

There's definitely room for improvement!

Checklist

  • Updated Settings section in README.md, if settings are affected
  • Jest tests

@mariusandra mariusandra requested a review from Twixes February 5, 2021 09:59
@mariusandra mariusandra mentioned this pull request Feb 5, 2021
2 tasks
@mariusandra mariusandra requested a review from Twixes February 8, 2021 16:55
Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

I don't think there are any results shown in the ClickHouse benchmark action. As a nit, the Postgres one's results are super noisy on the other hand

@mariusandra
Copy link
Collaborator Author

It's there:

    [Kafka & ClickHouse] Ingested 3000 events in 17.89s (167.66 events/sec, 5.96ms per event)

image

but yeah, noisy

@mariusandra mariusandra mentioned this pull request Feb 11, 2021
2 tasks
@mariusandra mariusandra requested a review from Twixes February 11, 2021 10:52
* improve logging

* ingest event in piscina

* benchmark piscina ingestion

* catch errors in ingestEvent

* ingest in piscina worker

* add KAFKA_BATCH_PARALELL_PROCESSING to ingest in parallel

* split kafka event processing into batches

* comment out plugin debug

* do not pause kafka if worker busy --> we do one batch per server at a time anyway

* fix broken test
@mariusandra mariusandra merged commit 79fdc0e into master Feb 11, 2021
@mariusandra mariusandra deleted the benchmark-ingestion branch February 11, 2021 11:33
fuziontech pushed a commit to PostHog/posthog that referenced this pull request Oct 12, 2021
* ingestion and e2e benchmarks

* add e2e kafka benchmark

* split benchmarks into 3 actions

* fix script

* fix test script folders

* eslint --fix

* fix clickhouse CI setup

* random change to make github actions have another go

* Parallel Ingestion (#144)

* improve logging

* ingest event in piscina

* benchmark piscina ingestion

* catch errors in ingestEvent

* ingest in piscina worker

* add KAFKA_BATCH_PARALELL_PROCESSING to ingest in parallel

* split kafka event processing into batches

* comment out plugin debug

* do not pause kafka if worker busy --> we do one batch per server at a time anyway

* fix broken test

Co-authored-by: Michael Matloka <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants