Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Concurrent Problem For Help

Open Losangelsdream opened this issue 3 years ago • 0 comments

Hi, I have some problem when using dotnet Core 2.2 + Dapper to construct a Project.

Problem1: In the beginning of the month, a huge number of requests coming into our program (mostly simple QUERY, some flexible QUERY ——about 20-40second, and a little INSERT or UPDATE), and MySQL's perform becoming pool, and soon causing error like "too many connections". I don't understand what may cause these problems. Too High Concurrent request? or these slow SQL. My Code like this: public IDbConnection GetDbConnection(){ Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true; var connectStr = "Database=xxx;Data Source=xxx;pooling=false;port=3306;Password=xxxx;"; return new MySqlConnection(connectStr) } with usage: string strQuerySql = "select * from blablabla where xxx = xxx"; using(var connection = GetReadDbConnection()){ var listData = connection.Query<xxxModel>(strQuerySql).ToList(); } is there anything wrong? Problem2:If I wanna using connection pool, I just need to modify my connectStr like this: var connectStr = "Database=xxx;Data Source=xxx;pooling=true;port=3306;Password=xxxx;min pool size = 10;max pool size = 150;"; is that Right? Expecting your reply ! Thank you so much.

Losangelsdream avatar Sep 07 '22 03:09 Losangelsdream