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)
- Inconsistency in Supported Language Count Between Repository Description and README HOT 1
- build fails on freebsd and libressl HOT 1
- grpc idle timeout is affected by `client_header_timeout header` HOT 2
- The issue about try_files cmd HOT 2
- review unit type choice HOT 1
- How to modify the value of nginx-unit backlog parameter? I want to increase it to meet my performance needs. It's time to change the default value, 511 is no longer applicable HOT 26
- Listeners 127.0.0.1:xx is not working, The prompt already exists, but I haven't seen the configuration anywhere HOT 3
- Upgrade wasm-wasi-component to latest Wasmtime HOT 2
- WAF
- Release 1.33 meta tasks HOT 10
- RHEL ARM Packages
- Mismatch in content of `SECURITY.txt` in Units and e.g. NGINX Agents / NJS Repositories HOT 4
- "error": "Failed to apply new configuration." HOT 3
- Current git HEAD tests issue a Rust-related error HOT 6
- Current git HEAD tests fail if Unit is built without njs: test_routes_match_if HOT 4
- Current git HEAD tests fail on Ubuntu 24.04: isolation_rootfs HOT 6
- Current git HEAD tests fail on FreeBSD 14 / Python 3.11.9: test_python_factory_invalid_callable_value HOT 7
- HTTP request is sent twice in Node app HOT 7
- docker: access log is owned by root HOT 2
- unitctl: rename app to apps
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.