开发者

Limit database concurrent connections in regard to web (http) requests

开发者 https://www.devze.com 2023-03-10 16:39 出处:网络
How can I, by using php, limit the number of incoming connections so it doesn\'t exceed 1000 (which I think will allow good performance f开发者_开发知识库or my small app) and just ask incoming users t

How can I, by using php, limit the number of incoming connections so it doesn't exceed 1000 (which I think will allow good performance f开发者_开发知识库or my small app) and just ask incoming users to wait x time if said number is reached?

So far the only thing I've come up with is to add a table with a number of connections and substract 1 when a user enters and when that counter reaches 0 then ask to wait, but I think there should be a better way.


HTTP is stateless, there is no such thing as a connection, per say. You need to have some sort of session handling system and limit it there.


If you're using MySQL there is an option called max_user_connections and max_connections

But I'm not really sure if it is what you need, or how to know when the limit is reached.

0

精彩评论

暂无评论...
验证码 换一张
取 消