What's new in Passenger 5 part 1: performance and HTTP JSON API
We're happy to announce version 5.0.1 of the Phusion Passenger application server for Ruby, Python and Node.js. Version 5.0.1 is officially ready for production.
The 5.x series is also unofficially known under the codename "Raptor", and introduces many major improvements such as:
- Much better performance
- A new HTTP JSON API for better insights into server and application behavior
- Better logging
- Better WebSocket support
This is part 1 of a two-part blog post which describes the main changes in Passenger 5. See also part 2: better logging, better restarting, better WebSockets and more.
To learn how to upgrade to Passenger 5, please refer to the release notes.
Much improved performance
Last year, we embarked on an ambitious journey to raise Passenger's performance. This journey took many months of blood, sweat and tears.
The improved performance is not the result of a single change, but of many different techniques combined. We had to rewrite a large part of the Passenger codebase in order to achieve our goal. But rewriting a lot of code is also risky because it can introduce new bugs.
Many people and organizations all over the world are relying on Passenger, so we want to make sure that whatever we release is stable and ready for production. That's why the Passenger 5 series had gone through multiple betas and release candidates. With version 5.0.1, we are confident that it is ready for production.
Turbocaching: integrated HTTP caching
Passenger 5 introduces integrated HTTP caching, called turbocaching. When used correctly, it can drastically improve your app's performance. Turbocaching is described in the Server Optimization Guide and at the Raptor blog.
The turbocache is a fully in-memory cache and with a limited size. The turbocache is not meant to be a general-purpose cache like Varnish with many fancy features. Instead, it is optimized to handled bursts of traffic to a small number of end points. For example, to help your server survive when your website or app suddenly becomes viral and receives lots of traffic.
You do not need to install any gems or libraries to utilize the turbocache. Because it's a normal HTTP cache, all you have to do is to set the right HTTP caching headers, and it'll work automatically. There is nothing to configure and nothing to manage.
Optimization guide
To help users maximize Passenger's performance, we've published a Server Optimization Guide with many tips.
Builtin web server
Passenger 5 does not require Nginx or Apache anymore. It now has a builtin web server. This is perfect for environments where you want to avoid the overhead of another Nginx/Apache instance, for example if you're already running Nginx at the load balancer level.
The builtin web server can be accessed through Passenger Standalone by passing --engine=builtin
:
passenger start --engine=builtin
Please note that the builtin web server has fewer features than Nginx, by design. The builtin web server does not support things like gzip compression, while Nginx does. So we only recommend you to use the builtin web server if you have a specific reason to, as documented in the server optimization guide.
HTTP JSON API
We've long embraced the Unix philosophy of making tools that are composable and scriptable. In version 5, we're taking this philosophy to a new level with our new HTTP JSON API.
This API exposes Passenger's internal state. You can query information such as:
- A detailed dump of active requests.
- The state of the application processes that are being managed by Passenger.
- Passenger configuration and runtime parameters.
You can even control Passenger and make changes:
- Restarting apps.
- Initiate log rotation.
- Changing configuration on-the-fly, such as the log level.
The fact that it's HTTP and JSON means that you can reuse the wide array of existing HTTP tools. For example, you can access the API with standard client tools and libraries such as curl and Net::HTTP. No need to install custom tooling or implementing custom protocols. You can easily add security or load balancing by using Nginx, HAProxy or any other full-fledged HTTP server you prefer.
You can even access the API from a web app. This allows you to easily integrate Passenger information in monitoring panels.
We're currently working on better documentation for the HTTP JSON API. You can expect a blog post about this topic in the near future.
Passenger Enterprise updated
Phusion Passenger also has an Enterprise version which comes with a wide array of additional features such as zero-downtime restarts, multithreading, better debugging support, etc.
Passenger Enterprise has been updated as well. All the changes you learned about in this article, are also available in the Enterprise version.
By buying Phusion Passenger Enterprise you will directly sponsor the development of the open source version.
Learn more about Passenger Enterprise »
Conclusion
This is part 1 of a two-part blog post which describes the main changes in Passenger 5. See also part 2: better logging, better restarting, better WebSockets and more.
To learn how to upgrade to Passenger 5, please refer to the release notes.