Is db_query() closing connections?
You need to make sure the number of MySQL connections (max_connections in my.cnf) is greater than the number of PHP processes (pm.max_children if you use php-fpm, or MaxClients if you're using Apache mod_php).

The default for Apache is often 300, and the MySQL default is only 100, so you can run out of connections pretty quickly if these values aren't tuned.