refactor: migrate to typescript, undici, and improve contributing#42
refactor: migrate to typescript, undici, and improve contributing#42glasstiger merged 2 commits intoquestdb:mainfrom
Conversation
woss
left a comment
There was a problem hiding this comment.
Excellent PR!
I have left a few comments.
|
@puzpuzpuz @glasstiger a cool review here would be super nice:) sorry for pinging just want to move this forward |
|
Wow, that's a biggish PR! We may need some time to review it, so please keep this in mind. |
Yes, no hurry from my side, we forked internally and using it already in production, just wanted to ping to make sure that you're "subscribed" to this repo :) |
- Bumped versions of several devDependencies in package.json and pnpm-lock.yaml, including eslint, prettier, and testcontainers. - Enhanced the Sender class by introducing a flushPromiseChain to manage flush operations sequentially, ensuring data integrity during high load. - Refactored the HTTP request handling to improve error logging and response management. - Added new private methods for buffer management and data sending logic. - Updated tests to reflect changes in error messages and ensure proper functionality under high load conditions.
|
@semoal, sorry, it took a long long time to get to it, but I am reviewing your PR. This PR could have been cut into 3-4 separate ones, tbh. |
glasstiger
left a comment
There was a problem hiding this comment.
In spite of the many comments I am approving this PR.
We were planning to port the codebase to typescript, and introducing undici as transport is a very good idea.
I will be raising multiple PRs to address the comments on this PR.
| @@ -1,10 +1,14 @@ | |||
| const { Sender } = require('@questdb/nodejs-client') | |||
There was a problem hiding this comment.
We could add typescript examples too.
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node-version: [16, latest] |
There was a problem hiding this comment.
It would be nice to keep compatibility with node 18 at least, but it is ok if we cannot.
| on: | ||
| push: | ||
| schedule: | ||
| - cron: '15 2,10,18 * * *' |
There was a problem hiding this comment.
This build was scheduled to run 3 times a day to catch possible incompatibility issues with the server.
Would be good to keep it that way.
The server moves very fast, and it is good to see early on, if we broke compatibility with the clients.
|
Just wanted to chime in that this was a great move, @semoal did you guys a massive solid. All the libs he chose are de facto A+ tools in a modern TS/Node ecosystem that will give the questdb node client new life. |
Hey Jon, thanks for your comment - we agree fully! This contribution went far above and beyond, and we are very excited to finally release these improvements, alongside support for the new N-dimensional array type. Feedback and support from our OSS community is absolutely critical to ensure the software is robust and fit for purpose. @semoal definitely deserves more kudos and applause for his contribution! |
|
@semoal, @JonDum, I am sorry it did not really come through in my merge comment that this PR provides tremendous value for us. |

Hi guys, hope this pull-request suits you well
I've had a boring weekend and had time to give some love to this library, QuestDb is cool but db clients experience must be a requirement for you as a company, so since it's open-source I'm happy to collaborate with you 🤟
What's new?
CONTRIBUTING.mdguide for making it easier to collaborate and introduce new features.Breaking changes
Undiciwhich is by far better, easier to handle retry, faster, and more maintained and its core contributors are Node maintainers.Performance improvements
Getting rid of http.agent and using Undici made that when I've installed the library in my project and run some benchmarks creating 2M rows in 64 iterations with a time limit of 5000ms of run we had a nice result:
Latency (average):
v4.0.0achieves a ~14% reduction in average latency, indicating faster performance.Latency (median):
v4.0.0shows a significant improvement in median latency, reducing it by ~28%.Throughput (average):
v4.0.0.Throughput (median):
v4.0.0delivers a ~35% improvement in median throughput.Summary of Improvements
v4.0.0demonstrates superior performance and efficiency compared tov3.0.0.These results confirm the improvements introduced in
v4.0.0, making it a faster and more capable version.