OpenSource For You

The general solution

-

A straightfo­rward solution to the ‘ everything in one request- response cycle’ problem is don’t do everything ~ t once; bre~ k the request- response cycle ( see Figure 2). If you can identify which tasks are less important, you can offload these onto another process, and reduce the work that your Web server threads do. By doing this, you reduce the response- to- user time. Please note, what I mean by less import~ nt work is not work that can be skipped or omitted, but which need not be done immediatel­y, as it does not affect the user response. For example, sending an email is an important part of your applicatio­n— but it does not directly change the response your server sends to the user. Therefore, whether it’s sent before or after sending the user response does not really matter.

So, your Web server threads take care of receiving the UHTuHVW DQG GRLQJ HVVHQWLDO WhLQJV fiUVW—DQG HYHUyWhLQJ that does not directly affect the user response should EH RIflRDGHG WR DQRWhHU SURFHVV, VR WhDW WhRVH WhLQJV DUH worked upon in the background, without making the user wait. Also, the reduction in tasks improves the performanc­e of your Web applicatio­n; the server takes less time to process the request. Thus, your server will also be able to handle a lot more requests.

Newspapers in English

Newspapers from India