How does a server handle web service requests from multiple clients

前端 未结 4 2080
野的像风
野的像风 2020-12-31 19:19

I just completed an Android application that uses web services to connect to a remote database. I was working on localhost.

Now, I plan to host my web services on a

4条回答
  •  天涯浪人
    2020-12-31 19:55

    a) one instance of the web service( example: spring boot micro service) runs/listens in the server machine at port like 80.

    b) This webservice(Spring boot app) needs a servlet container like mostly tomcat. This container will have thread pool configured.

    c) when ever request come from different users simultaneously, this container will assign each thread from the pool for each of the incoming requests.

    d) Since the server side web service code will have beans(in case java) mostly singleton, each thread pertaining to each request will call the singleton API's and if there is a need for Database access , then synchronization of these threads is needed which is done through the @transactional annotation. This annotation synchronizes the database operation.

提交回复
热议问题