optimized calculation of request count for requests matching response_code