DB Connections in ASP.NET, MySQL, and SQL Server

I use MySQL in the ASP.NET project that I am currently working on, I conducted several tests to test the performance of the MySQL.NET provider, but, unfortunately, I am not very happy with the results.

A very simple loop that opens a connection is only 10 times faster in SQL Server:

// MySQL

const string CONNECTION_STRING = 
"server=localhost;database=testdb;user id=root;password=mypassword;max pool size=250;";
for (int i = 0; i < 5000; i++)
{
  using (MySqlConnection con = new MySqlConnection(CONNECTION_STRING))
  {
    con.Open();
  }
}

// SQL Server

const string CONNECTION_STRING = "Data Source=localhost;Initial Catalog=testdb;Integrated Security=True;max pool size=250;";
for (int i = 0; i < 5000; i++)
{
  using (SqlConnection con = new SqlConnection(CONNECTION_STRING))
  {
    con.Open();
  }
}

SQL Server is much faster in everything else (selects, updates, inserts, etc.). Am I doing something wrong? are there any server variables that i have to change?

Additional information:
- I run MySQL on Windows (5.0.51a-community-nt)
- SQL Server 2005 was used in testing
- Specifications: Windows XP SP2, Intel 1.6 GHz processor with two cores, 1024 MB RAM

This is the MySQL configuration:

[client]
port        = 3306
socket      = /tmp/mysql.sock

[mysqld]
port        = 3306
socket      = /tmp/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8

server-id   = 1

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

Thanks for any suggestions ...

+3
3

SQL- : , , . , . , MySql

+4

- , mySQL, , ? MySQL , , , , . SQL Server , . , mysql, , .

, Windows mysql, , , , Linux, .., , - , SQL

, , .. mysql
http://forums.mysql.com/read.php?24,92131,92131

+2

, , .NET- Sql Server, , Microsoft. .NET- - Sql Server, ​​, .

"" ASP.NET , . -, 100% - .

0

Source: https://habr.com/ru/post/1702415/


All Articles