When comparing Jetty vs Lighttpd, the Slant community recommends Lighttpd for most people. In the question“What are the best cross-platform lightweight HTTP servers?” Lighttpd is ranked 3rd while Jetty is ranked 4th.
Ranked in these QuestionsQuestion Ranking
Pro Embedded mode
A Jetty instance can be spawned entirely from Java code (without an external installation or config files), making it a very handy companion for unit/integration tests, conditional/temporary server spawning, and the like.
Jetty was not designed to be an application server, rather it was built from the ground up to be a collection of components that provide HTTP and servlet services. This results in Jetty being very flexible as well as the following benefits:
- Very simple to extend and/or replace components with customized behavior.
- The integration of Jetty into development tools like maven can be very flexible as the components that control the layout of a webapp can be updated to run an unassembled application from source rather than an assembled WAR.
- Very easy to remove features that are not being used to save on memory and CPU costs.
Due to this flexibility Jetty can be used in the following use cases:
- A stand-alone traditional web server for static and dynamic content
- A dynamic content server behind a dedicated HTTP server such as Apache using mod_proxy or mod_jk
- An embedded component within a java application
- As a component to build an application server or Java EE server
For a full list of software powered by Jetty go here.
Because Jetty is built by an assembly of simple components it is very easy to work with. Where possible, features are added by aggregation of components rather than creation of complex deep/optional APIs
Assembly and configuration can be done by the java API, the jetty XML configuration file, which is an IOC style mapping of XML to POJO APIs, other IOC/component frameworks such as Spring and Plexus, OSGi activators, and other XML to POJO mappings such as XBeans
All APIs are public which has resulted in all of the Jetty code being very well maintained and easily understood.
Pro Simple setup for static content
Pro Fast and built for scalability
Lighttpd is event-driven, asynchronous, non-blocking and single threaded. This allows lighttpd to be manage resources more efficiently compared to thread-based models (like Apache).
Pro Free and open source
Lighttpd offers a more basic set of functions out of the box compared most web servers. Extra functionality can be added via modules.
Con No built-in WSGI support
Lighttpd lacks Web Server Gateway Interface support.