how a web server(apache) handles multiple HTTP req

2019-06-03 23:42发布

Hope this is not something obvious, just want to clarify some things I am not totally sure about. I got this question while watching a tutorial on how to implement caching. There is seems that just adding some global caching variables on the server, will implement caching for all clients. I use PHP with Apache webserver.

I know that a web-server can accept multiple client HTTP requests. My question is what happens on the web server code.

Is the same server code executed each time? Meaning that some global variables are preserved? Or for each new HTTP request, a new instance of the code is created. If yes, are those multiple instances connected or can be made aware of each other in any way?

1条回答
啃猪蹄的小仙女
2楼-- · 2019-06-04 00:14

Bad news is the apache server does not native support for that kind of work. You have to use some intermediate stuff like database to handle this. However, good news is node.js do that stuff easily in an elegance way :D

查看更多
登录 后发表回答