Application Server
- In Turkish
- Uygulama Sunucusu
In short
An application server is software that runs an application's code and business logic, turning requests into dynamic responses, usually behind a web server.
What is an application server?
An application server is the program, or the machine running it, that hosts an application's code and runs its business logic: checking input, talking to databases and building the response for each request. Besides running the code, it usually provides shared services the code relies on, such as managing threads or worker processes, pooling database connections, handling sessions and transactions, and applying security rules.
The term comes from enterprise Java, where full application servers such as WildFly (formerly JBoss), Open Liberty, Oracle WebLogic and GlassFish implement the Java EE platform, now called Jakarta EE, and run applications deployed to them as WAR or EAR files. Lighter servers such as Apache Tomcat and Jetty implement only the web part, servlets, and are often called servlet containers. Other ecosystems have their own: Gunicorn and Uvicorn run Python apps, Puma runs Ruby on Rails, PHP-FPM runs PHP, and Kestrel runs ASP.NET Core.
In a typical setup, a web server or reverse proxy such as NGINX faces the internet, handles HTTPS and serves static files, and forwards dynamic requests to the application server, which in turn talks to the database. If the web server is a restaurant's front counter, the application server is the kitchen where each order is actually cooked. Many modern frameworks embed the server in the application itself: a Spring Boot app ships with Tomcat inside a single JAR file, and a Node.js app opens its own HTTP server.
Application servers are often confused with web servers, and the line between them is blurry. A web server specializes in HTTP connections, files, TLS and routing, while an application server specializes in running code; yet Tomcat can serve files too, and NGINX can run small scripts through modules. The distinction is about the main job each one does in the stack, not a strict technical boundary.
Key takeaways
- An application server runs an application's code and builds dynamic responses.
- It provides shared services such as worker management, connection pools, sessions and transactions.
- Java application servers implement Jakarta EE, formerly Java EE; Tomcat is a lighter servlet container.
- Python, Ruby, PHP and .NET have their own, such as Gunicorn, Puma, PHP-FPM and Kestrel.
- A web server usually sits in front, handling HTTPS and static files.
Example
# app.py: the application code, as a minimal WSGI app
def app(environ, start_response):
name = environ.get("QUERY_STRING") or "world" # e.g. /?Ada
start_response("200 OK", [("Content-Type", "text/plain")])
return [f"Hello, {name}!".encode()]
# Gunicorn, a Python application server, runs it with 4 worker processes:
# gunicorn --workers 4 --bind 127.0.0.1:8000 app:app
#
# NGINX, the web server, handles HTTPS on port 443 and forwards to it:
# location / { proxy_pass http://127.0.0.1:8000; }Readers ask
What is the difference between a web server and an application server?
A web server handles HTTP connections, HTTPS and static files, while an application server runs the code that builds dynamic responses. In most deployments, the web server sits in front and forwards dynamic requests to the application server.
Is Tomcat an application server?
Loosely, yes, and many people call it one. Strictly, Tomcat is a servlet container that implements only the web parts of Jakarta EE, while full application servers such as WildFly or GlassFish also implement the rest of the platform, such as transactions and messaging.
Do I still need an application server?
Every web application needs something that runs its code, but today it is often built in rather than installed separately. Spring Boot, ASP.NET Core and Node.js apps include their own server, and containers have largely replaced deploying many apps to one shared Java application server.
See also
- Web ServerBackend & APIs, p. 50A web server is software, or the machine running it, that accepts HTTP requests from browsers and other clients and responds with pages, files, or data.
- Reverse ProxyDevOps & Cloud, p. 51A reverse proxy is a server that sits in front of web servers, accepts client requests on their behalf, and forwards each request to the right backend server.
- Spring BootBackend & APIs, p. 49Spring Boot is a Java framework for quickly building production-ready services on top of Spring, with auto-configuration and an embedded web server.
- JavaProgramming Languages, p. 15Java is a statically typed, object-oriented programming language that compiles to bytecode for the Java Virtual Machine, so programs run on many platforms.
- Connection PoolDatabases, p. 4A connection pool is a cache of open database connections that an application reuses across requests, avoiding the cost of opening a new connection every time.
- MiddlewareBackend & APIs, p. 33Middleware is software that sits between two layers of a system, most often code that runs between an incoming request and the final response in a web server.
Sources
Spotted a mistake or something missing on this page?Suggest an edit