-
Notifications
You must be signed in to change notification settings - Fork 13
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
Performances #30
Comments
I made few tests running also the profiler pyroscope on top of it. The tests was quite simple:
Sending 1 milions of messages with publish_batch. From peryscope profiler it seems like the function which take most time are the indeed the __ bytes __ at amqp.py:21 when we run the first version of the test and the function encode_struct encoding.py:98 which takes 3.5 seconds in total (cumulative test) |
Hi @DanielePalaia, have you tried py-spy profiler? It can output nice flamegraph visualizations of stack traces by the time they take Also it would be great if your could post a flamegraph report to this thread |
Hi @qweeze This is the output from from pyroscope. |
hi @DanielePalaia someone in the Pyroscope slack channel let us know about this issue -- just wanted to say a few things FYI
and then if you upload them to flamegraph.com results in either:
Hope this helps! Feel free to let us know if there's any functionality that you want/need that doesn't exist |
Didn't know about https://flamegraph.com, very cool 😅 Thanks @DanielePalaia, seems that uamqp and encoding takes quite some time indeed Also I made a couple of quick and dirty optimizations to the encoding module in this branch. I got ~50% speedup on a test like this frame = schema.Publish(publisher_id=1, messages=[schema.Message(publishing_id=123, data=b"hello")])
for _ in range(100_000):
encode_frame(frame) I'm not an expert on performance, but I doubt that it's possible to radically improve performance using only pure python for low-level stuff like binary protocol encoding/decoding. If speed is a concern maybe we should consider alternative ways, such as using cython or c / rust extension |
@qweeze Thank you for your improvements, I will have a look! |
Using the test-encoding-optimization branch with the previous example is generating an exception:
Will try to have a look! |
@DanielePalaia sorry I accidentally broke decoding in this branch, now fixed in 28dd87d |
Hi @qweeze I made a few tests on these new improvements. On 3 milions of messages sent in binary: And sent in amqp format I think is a nice improment anyway. Would it be possible to make an official PR that we can review and maybe merge? |
This PR #100 increases the performances a bit. |
Test the performance and evaluate a way to aggregate the messages before sending the messages.
The text was updated successfully, but these errors were encountered: