I am working on a java based multi-tenant architecture. So multiple customer data will be stored in a single MySql DB. Now in DB level (InnoDB), we have set innodb_thread_concurrency value as 20. Hence only 20 parallel request will be served at any instance by MySQL. Each query can execute from 0ms to 5 mins. The problem is how can I set customer wise concurrency limit in this case. Also how can I split my thread across each bucket (bucket means 1 – 10ms query as one bucket, 11 – 100 ms query as second bucket, and so on).
I have collected number of parallel request served by each DB at an instance (each ms) for a period of 10 minutes. I have also collected execution time of each query. From this data, we can infer how many 0ms, 1ms and so on…. queries has been served by the DB at any instance.
With these data, how can I derive concurrency limit. Kindly suggest any formula or any alternative approaches to deduce the same.