简体   繁体   English

Tomcat 真的是 web 服务器吗?

[英]Is Tomcat really a web server?

I was learning the difference between application server and web server and I read these difference我正在学习应用程序服务器和 web 服务器之间的区别,我阅读了这些区别

  1. In web servers, multithreading is not supported.在 web 服务器中,不支持多线程。
  2. A Web server will not itself support transactions or database connection pooling Web 服务器本身不支持事务或数据库连接池

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. 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.曾几何时,web 是 static。 It means webservers were able to serve files from a filesystem via http, much like FTP servers serve files via FTP.这意味着网络服务器能够通过 http 从文件系统提供文件,就像 FTP 服务器通过 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. go 动态的第一次尝试是 CGI 脚本,这对小型项目很有用,但对于较大的项目,它们仍然会受到伤害 - 在性能和代码维护方面。

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.一个这样的例子是 JServ,它是第一个 servlet 容器。 It was able to run servlets but not serve static files.它能够运行 servlets 但不能提供 static 文件。 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. go:您有一个用于 static 文件的网络服务器,以及一个用于处理动态内容的应用程序(服务器)。

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.没过多久,有人创建了一个可以为 static 文件提供服务的 servlet——但许多网站仍然做出了区分,因为使用普通网络服务器提供 static 文件将花费更少的资源。

The resource overhead is not that painful today, and thus you can use application servers as replacements for webservers.今天的资源开销并不那么痛苦,因此您可以使用应用程序服务器作为 Web 服务器的替代品。 And still webservers are commonly used before application servers, simply to reduce the facade on the web and thus possible attack vectors.并且仍然在应用程序服务器之前通常使用网络服务器,只是为了减少 web 的外观,从而减少可能的攻击向量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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