How to set limit to the number of concurrent request in servlet?

后端 未结 5 1670
轻奢々
轻奢々 2020-12-09 23:55

I got this servlet which return a pdf file to the client web browser. We do not want to risk any chance that when the number of request is too much, the server is paralyzed.

5条回答
  •  清歌不尽
    2020-12-10 00:20

    If you are serving static files, it's unlikely that the server will crash. The bottleneck would be the network throughput, and it degrades gracefully - when more requests come in, each still get served, just a little bit slower.

    If you set a hard limit on total requests, remember to set a limit on requests per IP. Otherwise, it's easy for one bad guy to issue N requests, deliberately read the responses very slowly, and totally clog your service. This works even if he's on a dialup and your server network has a vast throughput.

提交回复
热议问题