简体   繁体   中英

Is Tomcat really a web server?

I was learning the difference between application server and web server and I read these difference

  1. In web servers, multithreading is not supported.
  2. A Web server will not itself support transactions or database connection pooling

Actually my java application is deployed in Tomcat server and it actually supports multithreading, transactions etc. But I also read that tomcat is a web server. So how is this possible?

Once upon a time the web was static. It means webservers were able to serve files from a filesystem via http, much like FTP servers serve files via FTP. First attempts to go dynamic were CGI scripts, which were good for small projects but for bigger ones they would still hurt - in performance and in code maintenance.

One of the alternatives was to have the webserver forward requests to applications running elsewhere/in other processes. One such example is JServ, which was the first servlet container. It was able to run servlets but not serve static files. So you would use it to process dynamic content only.

There you go: You have a webserver for static files, and an application (server) to care about dynamic content.

It did not take long until someone created a servlet that would serve static files - yet a lot of websites still make the distinction as serving static files would cost less resources with a plain webserver.

The resource overhead is not that painful today, and thus you can use application servers as replacements for webservers. And still webservers are commonly used before application servers, simply to reduce the facade on the web and thus possible attack vectors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM