Without more information about your configuration it's very hard to answer. Typically. both webservers and databases have configuration options that either explicitly or implicitly limit the number of concurrent connections. And as @Ben points out, it's possible to do this at the operating system level, too.
If this is more than an academic question (that is, if you're running into a specific problem to which you're looking for a solution), give us more information and we'll see what we can do.
"All of the above."
Without more information about your configuration it's very hard to answer. Typically. both webservers and databases have configuration options that either explicitly or implicitly limit the number of concurrent connections. And as @Ben points out, it's possible to do this at the operating system level, too.
If this is more than an academic question (that is, if you're running into a specific problem to which you're looking for a solution), give us more information and we'll see what we can do.