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

Websocket with lots of data and slow clients causes memory issues #760

Open
wsneijers opened this issue Feb 2, 2024 · 2 comments
Open
Labels
question Issue can be closed by providing information

Comments

@wsneijers
Copy link

Hi,

I'm using the websockets feature to send binary data (image thumbnails) to one or more clients. However I'm noticing that if there is one or more slower clients (connections speed wise) the memory consumption goes up drastically. Till the point the system runs out of it and the process crashes. For reference the code:

image

image

What I'm seeing is that the data is committed with asio::post, which is non-blocking. Is there a way to make this blocking? Or can I somehow see the buffer is filling up? What I would like to do is slow down the data rate when the buffer gets to full.

For reference I'm using commit 84ec783

Thanks for any assistance!

@gittiver gittiver added the question Issue can be closed by providing information label Feb 2, 2024
@gittiver
Copy link
Member

gittiver commented Feb 3, 2024

Could you wait for ack from other side?
i had a short look, the asynchronous dispatch is not directly available, so it may be some effort to add it.

@wsneijers
Copy link
Author

Hi,

Yes waiting for the other side to ack would be an option ofcourse. I'm just wondering if it's also possible to limit from the server side (preventing logic in clients). What exactly do you mean by asynchronous dispatch? I'm willing to put in work. But am a bit lost in where to start...

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue can be closed by providing information
Projects
None yet
Development

No branches or pull requests

2 participants