Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the insert performance in the server #75

Open
vaibhav-kaushal opened this issue Oct 13, 2023 · 5 comments · May be fixed by #94
Open

Improve the insert performance in the server #75

vaibhav-kaushal opened this issue Oct 13, 2023 · 5 comments · May be fixed by #94
Milestone

Comments

@vaibhav-kaushal
Copy link
Contributor

vaibhav-kaushal commented Oct 13, 2023

We are performing way too many allocations in the StartWritingLogs function in the server log writer file. We need to optimize that so that high bursts of incoming log traffic could be ingested. Things we can try:

  1. We can move the code in the BarkLogDao.InsertBatch function to the StartWritingLogs function - that should avoid the memory copy required for making the function call and the memory allocations happening inside the InsertBatch function.
  2. We can allocate a variable for large, medium and small batches. These should be arrays instead of slices so that the loop does not have to reallocate the slice on append.
@vaibhav-kaushal vaibhav-kaushal added this to the Version 1.2 milestone Oct 19, 2023
@itishrishikesh
Copy link
Contributor

working on this

@bhagatvansh
Copy link
Contributor

Great, do you wanna collaborate on this? Seems like a good issue to work on.

@itishrishikesh itishrishikesh linked a pull request Oct 27, 2023 that will close this issue
@itishrishikesh
Copy link
Contributor

Sure @bhagatvansh! Created a draft PR of the solution that I thought of, let me know what you think

@bhagatvansh
Copy link
Contributor

Sure, did you compare the memory performance?

@itishrishikesh
Copy link
Contributor

itishrishikesh commented Oct 27, 2023

@bhagatvansh Hadn't done it before, but checked just now, here's what I found,
The right side figures are the code on the main branch, and the left one is what I have written.
image

One weird thing is, for small batch size when we were creating multiple slices with append the difference between allocations are huge when compared with new code, but for medium and large size logs the difference is negligible, but still it's a little less.

I have added a test files, you can run the tests on your end once to verify.

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 a pull request may close this issue.

3 participants