This version moves away from individual INSERT statements for each individual request. Instead, database insertions are batched via large INSERT INTO ... SELECT * FROM UNNEST queries. This significantly increases the throughput, while also reducing database server load. In a benchmark on a real-world small virtual server, the default settings were good for ~5000 requests per second, and with some tuning, this bridge could achieve ~40.000 requests per second on a single CPU core of that virtual server. If you're using this bridge and your production workload exceeds that.. uh.. please email me. :)
Changes
- Potentially breaking: The short setting CLI flags, like
-dfor--database-urlhave been removed. If you used those, please migrate to the long form names or environment variables. - Potentially breaking: The default value for
QUEUE_SIZEhas been dropped to 50. Unless you handle hundreds of requests per second, this should not matter to you. - A new setting,
--insert-batch-size/INSERT_BATCH_SIZE, is available to set the size of batch insertions. The default batch size is 10, which should be fine for small setups. - Another setting,
--insert-timeout/INSERT_TIMEOUT, exists to throttleINSERTqueries. If the buffer doesn't immediately reachesINSERT_BATCH_SIZE, the tool waitsINSERT_TIMEOUTmilliseconds before inserting the log entries into the database. Defaults to 1 second. - You can now set the log level and log output format. Run with
--helpto see the available flags and values.