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

Any benefit to multiple sockets between a server and a single client instance using Boost Beast? #2853

Closed
ryanlandvater opened this issue Apr 13, 2024 · 4 comments

Comments

@ryanlandvater
Copy link

From what I have read it seems to me that because IO calls to the kernel cannot be execute in a parallel manner, there’s really no benefit to opening multiple separate sockets on different ports between a client and server instance.

For context, working on an application that transmits huge amount of image data between a server instance and a client application for diagnostic image viewing (I use beast for its awesome performance). Because the amount of data is so immense, I’ve been trying to really optimize the amount of data I can push through.

@vinniefalco
Copy link
Member

The first thing to try is to do as much work as possible per I/O. That means, you want to transfer large buffers of data. Say, at least one megabyte per I/O call. If you have very many small buffers you should try to combine them into a single BufferSequence, or try copying them into a single, large destination buffer. You will need to measure these approaches.

Are you using HTTP, or Websocket?

@ryanlandvater
Copy link
Author

ryanlandvater commented Apr 13, 2024

Awesome thank you! And just to help others reading this from our separate email thread, there is no benefit from opening multiple separate sockets on different ports between a client and server instance. It won't improve raw throughput.

I am using websocket as I think the upgraded protocol and ability to push data as it becomes available to the server from disk is most beneficial for this implementation.

If there is packet drop, does that delay the transmission to other clients or does the packet failure and TCP resend get a new spot in the the io_context run queue? As there will be many clients expecting imaging data from each containerized instance, ensuring all do not slow down due to one client's poor connection was another motivation for multiple sockets per client design.

@ryanlandvater ryanlandvater changed the title Any benefit to multiple sockets between a server and client? Any benefit to multiple sockets between a server and a single client instance using Boost Beast? Apr 13, 2024
@ashtum
Copy link
Collaborator

ashtum commented Apr 14, 2024

If there is packet drop, does that delay the transmission to other clients or does the packet failure and TCP resend get a new spot in the the io_context run queue? As there will be many clients expecting imaging data from each containerized instance, ensuring all do not slow down due to one client's poor connection was another motivation for multiple sockets per client design.

TCP packet retransmission (and other low-level tasks like sequence checking) is handled by the operating system's network stack, and they don't directly impact the application.

@ryanlandvater
Copy link
Author

Thank you

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