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

Optimize memory usage per client #698

Open
zuiderkwast opened this issue Jun 26, 2024 · 3 comments
Open

Optimize memory usage per client #698

zuiderkwast opened this issue Jun 26, 2024 · 3 comments

Comments

@zuiderkwast
Copy link
Contributor

zuiderkwast commented Jun 26, 2024

The client struct is quite large and valkey supports many connected clients.

  • Fields only for replica clients can be stored in a wrapper which is allocated only for replica clients.
  • Pubsub channels, pubsub patterns, etc. can use a similar wrapper maybe.
  • Fields like resp can use a smaller integer type.
  • Reordering fields so they can be packed more efficiently in the struct.
@virtualirfan
Copy link

Regarding reordering, has anyone done a cache line analysis to try and colocate fields that are often accessed together? Similarly to move apart fields that might be accessed to separate threads.

@zuiderkwast
Copy link
Contributor Author

@virtualirfan Not that I'm aware of.

@madolson
Copy link
Member

Similarly to move apart fields that might be accessed to separate threads.

Today clients are not concurrently accessed between multiple threads. (Although that will change soon, and we have done minimal analysis on that)

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

No branches or pull requests

3 participants