Passenger 5.0.26: high concurrency tweaks, WebSockets improvements, SELinux improvements, bugfixes

Version 5.0.26 of the Phusion Passenger application server for Ruby, Node.js, Meteor and Python has been released. It features a bunch of improvements in various areas like concurrency & WebSockets, Nginx dynamic module support, as well as a few bug fixes.

If you hadn't already, be sure to check out the many major improvements that the 5.x series of Passenger introduces. And please be aware that you can enjoy enterprise features and sponsor the open source development directly by buying Phusion Passenger Enterprise.

High concurrency options

In setups that require a high amount of concurrent connections it is necessary to tweak some settings within and outside Passenger.

The ulimit setting limits how many open connections (file decriptors) a process may have, and is usually the first setting that needs to be increased. It can be tricky to ensure custom ulimits are actually applied to a process, so we've introduced some help in the form of the core_file_descriptor_ulimit and app_file_descriptor_ulimit options. As long Passenger is started as root (and thus has the right to apply limits), it will make sure the limits are set as intended.

We've also increased two default settings that were set rather conservatively:

  1. The default value for the Passenger socket_backlog has been doubled from 1024 to 2048
  2. For Nginx/Standalone users, the default value for worker_connections in the template has been increased from 1024 to 4096

Together, these settings effectively allow about 2048 concurrent connections vs. about 512 before. Users requiring very high concurrency can raise these limits much further, but these defaults should be more in tune with the present time.

Improvements for WebSockets

Passenger now reports TCP half-closing events to Node.js and Meteor applications. Previously these were filtered out as a workaround for the lack of default support for half-closing in Node.js, but this is no longer needed. By dropping the workaround, applications can now detect request body and WebSocket closes without having to send data to the client, thereby freeing up resources faster as well as preventing unintentionally hanging sockets (e.g. if the applications forgets to send data).

Additionally, we've added two new statistics in the output of passenger-status --show=server that can help troubleshoot long-running requests (which are often WebSockets). The last_data_send_time and last_data_receive_time show when data last flowed in which direction. If a request takes longer than expected, these values gives hints about whether something is stuck (no data flowing), and if so, on which side (i.e. was data sent last by the client or the server/application).

SELinux policy upgrade support

Recent SELinux policy updates started breaking the Passenger SELinux policy. Users of our RPM packages had to manually work around this after every update (GH-1663). We've changed Passenger to reinstall its policy whenever the system SELinux policy is upgraded, so that users don't have to manually do this anymore.

Bug fixes

  • Fixes outputting Content-Length and Transfer-Encoding headers on HEAD requests for Ruby apps. These headers were omitted in previous versions on HEAD requests.
  • [Apache] Fixes compilation against Apache installations which include -pie in CFLAGS. Closes GH-1756.
  • [Standalone] Fixes "address already in use" errors when using the builtin engine.
  • [Union Station] Fixes custom logging time arguments getting overwritten by current time for Ruby apps (so some sub-blocks like "framework request processing" appeared shorter than they were). This could happen since the switch to monotonic clock in 5.0.22.

Various improvements

  • Thanks to Ruslan Ermilov from NGINX Inc, Passenger can now be compiled as an Nginx dynamic module.
  • [Enterprise] The rolling restart feature now waits until the old process is completely gone (drained its request queue, process exited) before proceeding with rolling restarting the next process. This results in friendlier resource usage during rolling restart.
  • passenger-status --show=server now reports the speed at which new requests are accepted.
  • Upgrades libuv to version 1.8.0.
  • [Standalone] Prints a warning when an unsupported configuration option in Passengerfile.json is set.

Installing 5.0.26

Please see the installation guide.

Upgrading to 5.0.26

We strongly advise staying up to date with the latest version.

See also the upgrade notes below!


OS X

Debian

Ubuntu

Heroku

Red Hat

CentOS

Ruby gem

Tarball

Docker

If you are upgrading from 4.x, please read the 5.0 upgrade notes to learn about potential upgrade caveats.

Special notes about capistrano-passenger

If you are using Capistrano and [capistrano-passenger], then it may fail with this error:

SSHKit::Runner::ExecuteError: Exception while executing as user@99.99.99.99: undefined method `[]' for nil:NilClass

NoMethodError: undefined method `[]' for nil:NilClass

Tasks: TOP => passenger:restart

This is due to an incompatibility in capistrano-passenger with Passenger 5.0.22 and later. Please upgrade capistrano-passenger to 0.2.0 or later.