Performance between pure python and python/rust with pyo3 #4307
mancioshell
started this conversation in
Show and tell
Replies: 2 comments 4 replies
-
In addition, if i stress the hybrid python/rust microservice, i received an OOMKilled (exit code 137). |
Beta Was this translation helpful? Give feedback.
0 replies
-
Are you able to share this as a runnable repro in some form? Perhaps I can then investigate. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm testing two microservices which exposes a rest api with fastapi and performs some heavy aggregation query on mongodb.
The first microservice is written in pure python, the second one has the same fastapi route, but the code which performs the query is written in rust and exposed to the asyncio loop through pyo3 and pyo3_async.
This is the pyo3 code which expose the function:
This is the python code in common between the two microservices.
The code of python Repository Class and Rust Repository struct is pretty the same. He only takes a pipeline and perform an aggregagation query which write in a materialized view.
I'm struggle to understand why i haven't any performance enhancement. I have benchmarked with jmeter the microservices and the performance is almost the same.
Is it pyo3 not very usefull for io bound tasks?
Any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions