Jetty as a Lightweight Alternative to Tomcat
\nI was on a client call where the team kept asking why our simple admin app took longer to boot than the database. We had a clean Tomcat setup, stock connectors, a modest set of jars. Still, every tweak meant a new WAR and another coffee break. Out of frustration I swapped in Jetty and ran it straight from the project. The server came up before my email refreshed. The mood on the call changed. We fixed our bug while the old build job still chewed on its pipeline. That day I learned something simple. Sometimes the lighter tool isn�t just nice. It keeps momentum alive. \n\n\n\nTomcat is the default answer for many Java shops. It is everywhere, it is battle tested and it is predictable. Jetty is the quiet neighbor that never complains, small footprint, quick to start and easy to embed. If you are shipping a web app that fits the servlet model, Tomcat feels like a safe bet. If you need a lightweight servlet container, fast starts, and a closer feel to the code, Jetty is worth a look. The switch is not a religion. It is a practical call. Fewer moving parts, fewer surprises, quicker feedback. I have seen Jetty sit inside tools, test suites and tiny services that do one thing really well. That is hard to give up once you get used to it.\n\n\n\nJetty shines in daily work. The Maven Jetty plugin lets you run your app with a single command and see changes almost instantly. You can keep your editor open, hit save, refresh the browser, and you are back in the flow. No extra packaging step, no app manager to click through. Class reloading is not magic, but most projects see tight loops without drama. This is the kind of tool that cuts friction in half. Google�s dev tools lean on Jetty. GWT dev mode rides on it. Google App Engine runs apps on Jetty under the hood. That tells you Jetty is comfortable working both in development and at scale where the platform calls the shots. When the container is also your dev server, your team moves faster with fewer environment gaps.\n\n\n\nProduction is where people get tense, and for good reason. Tomcat earns trust with long service and a huge user base. Jetty earns it with clarity and control. You can embed Jetty right into your code and ship an app that brings its own server. That can remove a whole class of config drift on remote hosts. You can also run it as a standalone and front it with Apache HTTP Server or nginx for static files and TLS offload. Jetty has NIO connectors, request logging, JMX, and sane defaults. Its session managers can store to file or JDBC. Security realms exist, from simple HashLoginService to JAAS. If your shop needs the Tomcat manager app or tribal knowledge around Tomcat APR native, weigh that comfort against the crisp feeling of a smaller server that does exactly what you tell it. \n\n\n\nThe web is getting pushy. Long polling and chatty dashboards are everywhere. Jetty�s Continuations give you non blocking request handling before Servlet 3 lands everywhere. That matters for Comet and CometD, which Jetty supports cleanly. You keep threads free while holding the door for clients waiting on updates. Tomcat can do async as well, and the gap will narrow with new specs, but Jetty�s head start is hard to ignore. For teams building live feeds, trading tickers, or collaborative editors, a Jetty vs Tomcat test under real load is worth a weekend. Do not trust synthetic numbers. Put your real app behind Jetty�s NIO and watch thread counts and latencies under pressure. Small wins in this area multiply as traffic grows.\n\n\n\nWhat about operations and upgrades. The Eclipse Jetty 7 move brought a tidy Maven story and an active project home. Look for the new group ids and plugin coordinates. Watch your JSP and JSTL jars, keep them consistent with the container, and you avoid the classloader tangles that haunt every Java shop. Jetty�s config is plain XML and short. You can read it in a sitting and understand what is on. That alone saves time. Logs are straightforward. Metrics via JMX are enough for most setups, and you can wire them into your monitoring with little fuss. Memory wise, Jetty starts lean and stays polite. Tomcat has improved, but Jetty still tends to start quicker and idle lighter. If your box hosts multiple small apps or you need quick blue green switches, that speed matters. \n\n\n\nThere is no single winner. If your team already knows Tomcat inside out and your apps are traditional request response with occasional uploads, sticking with Tomcat is fine. If you are starting fresh, or you want to embed Jetty in a tool or service, or you need fast local development, Jetty pays for itself quickly. I like it for micro sized services, admin panels, internal dashboards, and any test harness that needs a real Java web server without the ceremony. It also fits continuous integration pipelines where a quick boot trims minutes day after day. On the flip side, if your security recipes, valve filters, or company policies are Tomcat heavy, do not fight the org for purity. Pick your battles. Ship value. \n\n\n\nSummary. Jetty is a lightweight alternative to Tomcat that trades a bit of ecosystem gravity for speed, clarity, and a friendly developer loop. It brings strong async support with Continuations and CometD, simple config, and a proven story behind the scenes in tools and platforms. Tomcat brings reach, habits, and a long track record that many ops teams love. Run your own bake off. Measure start time, memory, request throughput, and change turnaround. Then choose the server that makes your team faster and your nights quieter. The lesson is timeless. Keep the tool as small as the job allows, keep feedback tight, and the rest of the stack will thank you.