Replies: 1 comment 4 replies
-
|
I've tried that a lot, and while the idea sounds good, there are too many obstacles. Only plan b) might work. A few attempts:
There is a relic of these attempts in the current implementation: SearXNG uses the async API of httpx. See https://github.com/searxng/searxng/blob/master/searx/network/client.py However we are on the path to remove all async code: #2685 Why it does not work IMHO:
To sum up, I think that async Python does not fit the use case for SearXNG. An idea can be this: write the core components of SearXNG in Rust, and write the engines in Python (with pyo3 it should be "easy"). This is a very long road, but this is the opportunity to drop some of the legacies (see also #681 , #534 ) However, I might be wrong all along, Regarding memory footprint: #2633 Side topic: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello fellow developers!
I've been thinking of making SearXNG's codebase to fit modern Python standards better, one of the keys towards this goal is transitioning to ASGI.
The current SearXNG architecture primarily relies on Flask, coupled with uWSGI as the application server. While this setup has served us well, the benefits of embracing ASGI are numerous, especially on scalability. Modern Python's asynchronous features can significantly improve performance for I/O-bound tasks on a single thread. This means we don't have to spin up many workers to serve a public instance (since a worker uses ~150MiB memory on its own, this will quickly escalate to a scalability issue).
The elephant in the room is that we could not simply do a swap and expect huge performance gains in a effortless manner. Migrating to ASGI unfortunately need us to replace Flask with an ASGI-native framework (e.g., Starlette), thus indicates a huge refactor.
So there could be two paths for us:
+ likely less effort
+ keep the compatibility on people's workflow
- have to care about tech debts
+ asynchronous in mind from day one
+ as a chance to restructure and clean up the codebase
- needs much more effort
What are your thoughts? :)
Beta Was this translation helpful? Give feedback.
All reactions