Comments (9)
Is there a way to allow multiple threads in each python worker processs so for io bound application we can use threads and increase the number of request to handle?
Currently there's only one Python application thread per application process. Support for multiple threads is planned.
Also just wondering how is it different than apache web server which has almost the same offering and you can even run multiple applications using the same server via different virtualhost configs?
How is nginx different from apache?
Unit uses completely different, modern architecture. It contains main, controller, router, and application processes. Each process is isolated for specific purpose, which makes Unit extremely secure and robust.
- The router process is like improved version of nginx, it contains a number of threads and each thread is like an nginx worker process. They are asynchronous and can handle millions of connections simultaneously with minimal resources.
- The controller process provides RESTful JSON API interface, which is very easy to use. All configuration changes are applied dynamically and gracefully without reloading and connections loss.
- The application processes can dynamically load any versions of any interpreters independently and simultaneously. They communicate with the router process using very fast IPC, that is based on shared memory segments and adds minimum overhead to request processing.
Thus, it is modern, fast, secure, lightweight and dynamically reconfigurable server. When Unit will be production ready and feature rich, it will significantly simplify web stack and improve scalability.
from unit.
Thank you very much. Issue #107 has been opened.
from unit.
As Unit has reached v1.0, have you a vision when threads for python can be supported ? I tried, unsuccessfully, to use New Relic with Unit v1.0 and according to New Relic support, the problem is related to the lack of threading support in Unit.
from unit.
@urba1n You can open it in order to track updates and share information with community. We have already seen this error on another application. A fix for it is on review right now. It's not related to threads, but to a bug in our WSGI implementation.
from unit.
Thanks for the explanation VBart. Looking forward for the threading support in python. Do you know the timeline of Python Application Threads? Also, I know it is related to same, are there any plans to support asynchronous calls (i.e. async io or event based concurrency in python)?
from unit.
@eulhaque It's not in a short term plan. Our current goal is to stabilize current functionality and provide all the essentials to run classic WSGI applications. While threads support is a good optimization, it's less important than some other features that Unit is currently missing to be suitable for production use.
from unit.
@urba1n this ticket is about running WSGI applications in multiple threads in order to reduce memory usage. It has nothing to do with threading support inside Python. It should work well already. What's the problem with New Relic?
from unit.
Sorry, New Relic support points me to this particular issue, saying the issue is related the way NGINX Unit disallows multiple threads. Using new relic I get the following errors which prevents the application from running.
Apr 19 08:08:31 unit_as - Fatal Python error: GC object already tracked Apr 19 08:08:32 unit_as - 2018/04/19 08:08:31 [alert] 1#1 process 18 exited on signal 6 (core dumped) Apr 19 08:08:32 unit_as - 2018/04/19 08:08:31 [info] 17#39 *11 shutdown(50, 2) failed (107: Transport endpoint is not connected) Apr 19 08:08:32 unit_as - 2018/04/19 08:08:31 [info] 50#50 "unit-1|18-04-2018|17:33:54" application started Apr 19 08:08:32 unit_as - Fatal Python error: GC object already tracked Apr 19 08:08:32 unit_as - 2018/04/19 08:08:32 [alert] 1#1 process 23 exited on signal 6 (core dumped) Apr 19 08:08:32 unit_as - 2018/04/19 08:08:32 [info] 17#39 *26 shutdown(51, 2) failed (107: Transport endpoint is not connected) Apr 19 08:08:32 unit_as - 2018/04/19 08:08:32 [info] 55#55 "unit-1|18-04-2018|17:33:54" application started Apr 19 08:08:33 unit_as - 2018/04/19 08:08:33 [notice] 50#50 signal signo:17 (SIGCHLD) recevied, ignored
Should I open a new issue related to that ?
from unit.
Multithreaded request processing in Python apps can be configured since Unit 1.21.0.
See the docs: https://unit.nginx.org/configuration/#python
from unit.
Related Issues (20)
- Getting strange message when trying to get static files HOT 4
- Add PHP 8.3 image HOT 1
- Does nginx-unit want to support WSGI+ ? HOT 2
- Unit fails to build against njs 0.8.2 and libxml2 2.12, or njs 0.8.3 HOT 3
- ./configure: error: no PHP embed SAPI found when there is no libphp.so HOT 10
- Issue with creating files and folders from PHP HOT 3
- WebsocketConnection WebSocket onerror while trying nginx htpasswd protection HOT 1
- Using `vars` multiple times in `access_log.format` does not work correctly with njs HOT 3
- App process XXXX exited on signal 7 HOT 1
- Broken stdout and stderr logging in Amazon Linux HOT 4
- Application restart breaks WebAssembly Components HOT 8
- How to pass $request_id to my application?
- Support for modifying request headers HOT 3
- Ability to read mounted configuration file HOT 5
- Very hard to run .sh scripts from within Flask app HOT 2
- Consider updating containers to bookworm base image HOT 3
- Issue with WAR in unit-jsc11 HOT 6
- OpenSSL 3.2.1 breaks TLS related pytests HOT 4
- Module `wasm-wasi-component` is not found among available application modules HOT 3
- Choosing TLS library at startup time HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unit.