Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Unit 2019

166 views

Published on

Igor Sysoev, Founder and CTO of NGINX, presented at a SIOS-NGINX Meetup on February 12 on the NGINX Unit Roadmap.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Unit 2019

  1. 1. NGINX Unit new application platform Igor Sysoev co-founder and CTO NGINX Inc.
  2. 2. NGINX Unit • Web server which is able to run applications: • Python, PHP, Go, Perl, Ruby, Node.js and coming soon Java. • Runs on Linux, FreeBSD, macOS, Solaris. • Configuration: • JSON, • No configuration file, only remote RESTful API, • Dynamic reconfiguration entire server or just some part.
  3. 3. NGINX Unit • 6 Sep 2017 first public β version. • 12 Apr 2018 first stable version 1.0. • 7 Feb 2019 the latest version 1.7.1. • Open source, Apache 2.0 license. • http://unit.nginx.org • http://github.com/nginx/unit/
  4. 4. internet main controller router php wordpress blog python django shop
  5. 5. internet main controller router php wordpress blog python django shop
  6. 6. Controller process • Handles configuration changes via RESTful API. • Stores backup copy of configuration to use it on start. • For security reasons: • it runs under unprivileged user. • and listens on localhost interface or Unix domain socket.
  7. 7. Controller: JSON configuration "listeners": {
 "*:80": {
 "application": "blog"
 },
 }, "applications": {
 "blog": {
 "type": "php",
 "user": "wpuser",
 "processes": 5,
 "root": "/path/to/wordpress",
 "script": "index.php"
 },
 }
  8. 8. Controller: RESTful API curl -X PUT --data-binary @config.json
 http://localhost/config curl http://localhost/config curl http://localhost/config/listeners curl -X PUT -d '10'
 http://localhost/config/applications/blog/processes curl -X PUT --data-binary @blog-cert.pem
 http://localhost/certificates/blog
  9. 9. internet main controller router php wordpress blog python django shop
  10. 10. Router process • Handles HTTP clients connection and pass their requests to application worker processes. • Runs under unprivileged user. • Has several worker threads. • Each thread listens on own epoll/kqueue and can handle simultaneously thousands connections. • Each thread can work simultaneously with several generations of configurations.
  11. 11. internet main controller router php wordpress blog python django shop
  12. 12. Main process • Does not listen on ports. • Usually runs under privileged user (root): • to spawn and respawn other processes: controller, router, and application worker processes. • to bind listeners sockets and create log files on behalf of router process.
  13. 13. internet main controller router php wordpress blog python django shop
  14. 14. Applications • Drop-in replacement, no changes in application code: • PHP, Python, Perl, Ruby. • Small changes in application code: • Go: add import "nginx/unit" and use unit.ListenAndServe() instead of http.ListenAndServe(). • Node.js: use http = require("unit-http") instead of
 http = require("http"). • Changed Go and Node.js applications can be run standalone without Unit since the Unit-specific modules provides fallback HTTP processing.
  15. 15. Application processes • Run under unprivileged user, different applications can use different users. • Unit can run simultaneously several versions of PHP, Python, Perl, and Ruby: it is helpful for graceful application upgrade, A/B testing, etc.
  16. 16. Application processes • Communicate with router via Unix socket pairs and shared memory segments. • The shared memory segments are: • created on demand. • and private to each worker process so worker process crash does not affect other processes.
  17. 17. NGINX Unit • Web server which is able to run applications:
 Python, PHP, Go, Perl, Ruby, Node.js and coming soon Java. • Configuration: • JSON, • Remote RESTful API, • Dynamic reconfiguration. • http://unit.nginx.org
 http://github.com/nginx/unit/

×