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

Issues while receiving large BLOBs #557

Closed
symisc opened this Issue Jan 19, 2019 · 8 comments

Comments

Projects
None yet
2 participants
@symisc
Copy link

symisc commented Jan 19, 2019

Hi,

My JavaScript code basically send large chunk of 1MB BLOBs extracted from the browser canvas during the first interaction, after connection is successfully opened. While the Websocket server correctly accept & parse the incoming connection, extracting that chunk on the handler via websocket.recv(), takes at least 10 seconds to process on a powerful OVH dedicated machine.
Is there any issue slowing down this operation? or is there any parameter to tune to make thing goes faster on the server side?

Thank you @aaugustin for this amazing piece of work.

@aaugustin

This comment has been minimized.

Copy link
Owner

aaugustin commented Jan 23, 2019

I'm not sure what would cause this.

Perhaps a quick check: can you try import websockets.speedups in the same Python installation you're using to run this service? It should succeed; if it doesn't then that's the first thing to fix.

@symisc

This comment has been minimized.

Copy link
Author

symisc commented Jan 23, 2019

import websockets.speedups should be imported on the same script handling the connection?

@aaugustin

This comment has been minimized.

Copy link
Owner

aaugustin commented Jan 23, 2019

Yes.

@symisc

This comment has been minimized.

Copy link
Author

symisc commented Jan 23, 2019

Great. Thanks! One last question. Does running two instances or more of the same Websocket server say one on port 1000, the other on port 2000 and so forth improve concurrency? The basic idea here is to take advantages of multi-core CPUs since the event loop run on a singe core (process)?

@aaugustin

This comment has been minimized.

Copy link
Owner

aaugustin commented Feb 2, 2019

Yes, it does. Documenting this is part of #445.

@symisc symisc closed this Feb 2, 2019

@aaugustin

This comment has been minimized.

Copy link
Owner

aaugustin commented Feb 3, 2019

Did you figure out the slowness? It shouldn't take 10 seconds to load 1MB of data, even without the speedups.

@symisc

This comment has been minimized.

Copy link
Author

symisc commented Feb 3, 2019

Yes. Client side issue. I've wrapped websocket.recv() around asyncio.wait_for(timeout) to discard any intentional or non-intentional slow sender.

@aaugustin

This comment has been minimized.

Copy link
Owner

aaugustin commented Feb 3, 2019

Cool, thanks for the confirmation that websockets isn't at fault :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment