Giter VIP home page Giter VIP logo

Comments (9)

VBart avatar VBart commented on July 26, 2024 10

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.

urba1n avatar urba1n commented on July 26, 2024 2

Thank you very much. Issue #107 has been opened.

from unit.

urba1n avatar urba1n commented on July 26, 2024 1

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.

VBart avatar VBart commented on July 26, 2024 1

@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.

eulhaque avatar eulhaque commented on July 26, 2024

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.

VBart avatar VBart commented on July 26, 2024

@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.

VBart avatar VBart commented on July 26, 2024

@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.

urba1n avatar urba1n commented on July 26, 2024

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.

VBart avatar VBart commented on July 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.