From 6c5dc627bdeeea447b5eded94b32a02ed67d0419 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 31 Oct 2024 16:26:45 +0900 Subject: [PATCH 1/3] Allow changing common connection pooling settings For tweaking performance of large batch jobs. --- osu.Server.QueueProcessor/DatabaseAccess.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Server.QueueProcessor/DatabaseAccess.cs b/osu.Server.QueueProcessor/DatabaseAccess.cs index a209792..c9aa35f 100644 --- a/osu.Server.QueueProcessor/DatabaseAccess.cs +++ b/osu.Server.QueueProcessor/DatabaseAccess.cs @@ -25,10 +25,12 @@ public static MySqlConnection GetConnection() string user = (Environment.GetEnvironmentVariable("DB_USER") ?? "root"); string password = (Environment.GetEnvironmentVariable("DB_PASS") ?? string.Empty); string name = (Environment.GetEnvironmentVariable("DB_NAME") ?? "osu"); + bool pooling = Environment.GetEnvironmentVariable("DB_POOLING") != Boolean.FalseString && Environment.GetEnvironmentVariable("DB_POOLING") != "0"; + int maxPoolSize = int.Parse(Environment.GetEnvironmentVariable("DB_MAX_POOL_SIZE") ?? "100"); string passwordString = string.IsNullOrEmpty(password) ? string.Empty : $"Password={password};"; - connectionString = $"Server={host};Port={port};Database={name};User ID={user};{passwordString}ConnectionTimeout=5;ConnectionReset=false;Pooling=true;"; + connectionString = $"Server={host};Port={port};Database={name};User ID={user};{passwordString}ConnectionTimeout=5;ConnectionReset=false;Pooling={pooling};Max Pool Size={maxPoolSize};"; } var connection = new MySqlConnection(connectionString); From da2dde5ce884a18d7ceda2e17665dc6233f538c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 31 Oct 2024 18:08:34 +0900 Subject: [PATCH 2/3] Use string comparison --- osu.Server.QueueProcessor/DatabaseAccess.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Server.QueueProcessor/DatabaseAccess.cs b/osu.Server.QueueProcessor/DatabaseAccess.cs index c9aa35f..0792931 100644 --- a/osu.Server.QueueProcessor/DatabaseAccess.cs +++ b/osu.Server.QueueProcessor/DatabaseAccess.cs @@ -25,7 +25,8 @@ public static MySqlConnection GetConnection() string user = (Environment.GetEnvironmentVariable("DB_USER") ?? "root"); string password = (Environment.GetEnvironmentVariable("DB_PASS") ?? string.Empty); string name = (Environment.GetEnvironmentVariable("DB_NAME") ?? "osu"); - bool pooling = Environment.GetEnvironmentVariable("DB_POOLING") != Boolean.FalseString && Environment.GetEnvironmentVariable("DB_POOLING") != "0"; + bool pooling = string.Equals(Environment.GetEnvironmentVariable("DB_POOLING"), Boolean.FalseString, StringComparison.InvariantCultureIgnoreCase) + && Environment.GetEnvironmentVariable("DB_POOLING") != "0"; int maxPoolSize = int.Parse(Environment.GetEnvironmentVariable("DB_MAX_POOL_SIZE") ?? "100"); string passwordString = string.IsNullOrEmpty(password) ? string.Empty : $"Password={password};"; From 82c44727cf19849af1d1609b12d8e46835d6593d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 31 Oct 2024 18:08:39 +0900 Subject: [PATCH 3/3] Apply rider migration --- osu.Server.QueueProcessor.sln.DotSettings | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Server.QueueProcessor.sln.DotSettings b/osu.Server.QueueProcessor.sln.DotSettings index 1e04d7d..7099ad7 100644 --- a/osu.Server.QueueProcessor.sln.DotSettings +++ b/osu.Server.QueueProcessor.sln.DotSettings @@ -843,6 +843,7 @@ See the LICENCE file in the repository root for full licence text. True True True + True True True True