Database connection pooling with multi-threaded service

前端 未结 3 364
甜味超标
甜味超标 2021-01-12 01:23

I have a .NET 4 C# service that is using the TPL libraries for threading. We recently switched it to also use connection pooling, since one connection was becoming a bottle

3条回答
  •  心在旅途
    2021-01-12 01:53

    The simplest solution is to increase the connection timeout to the length of time you are willing to block a request before returning failure. There must be some length of time that is "too long".

    This effectively uses the connection pool as a work queue with a timeout. It's a lot easier than trying to implement one yourself. You would have to check the connection pool is fair ( FIFO ).

提交回复
热议问题