Domanda

I have an issue on running MySql on Windows server 2008 which has 32 GB Ram and Intel Xeon 2.70 Quad Core processor.

The database is only of 258 MB. While running a php script which export the data from database and dumps into dbf files. It takes 50 mins.

CPU Usage goes around ~50%. mostly take by mysqld.exe. CPU Usage goes around ~30% even if a single user logs in. I tested with 3 users and it went upto 63%

Below is my current configuration for my.ini:

    [client] 
    port            = 3306 
    socket          = "C:/xampp/mysql/mysql.sock"
    [mysqld]
    port= 3306
    socket = "C:/xampp/mysql/mysql.sock"
    basedir = "C:/xampp/mysql" 
    tmpdir = "C:/xampp/tmp" 
    datadir = "D:/ADAT_System/Database/data"
    pid_file = "mysql.pid"
    key_buffer = 16M
    max_allowed_packet = 1M
    sort_buffer_size = 512K
    net_buffer_length = 8K
    read_buffer_size = 256K
    read_rnd_buffer_size = 512K
    myisam_sort_buffer_size = 8M
    log_error = "mysql_error.log"
    log-output=FILE
    slow_query_log = ON
    long_query_time = 5
    query_cache_size = 128MB
    query_cache_type = ON
    query_cache_limit = 10MB
    plugin_dir = "C:/xampp/mysql/lib/plugin/" 
    skip-federated
    server-id
    innodb_data_home_dir = "D:/ADAT_System/Database/data"
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_log_group_home_dir = "D:/ADAT_System/Database/data"
    innodb_buffer_pool_size = 16M
    innodb_additional_mem_pool_size = 2M
    innodb_log_file_size = 5M
    innodb_log_buffer_size = 8M
    innodb_flush_log_at_trx_commit = 1
    innodb_lock_wait_timeout = 50
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [mysql]
    no-auto-rehash
    [isamchk]
    key_buffer = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    [myisamchk]
    [mysqlhotcopy]
    interactive-timeout

Could someone please help me in optimizing the MySQL.I am pretty new to this.

Thanks, Himanshu

È stato utile?

Soluzione

Generally a SQL request (Given that the DB is local) should be quicker than that. *granted. Try looking here for a great list of performance Tweaking. http://www.askapache.com/mysql/performance-tuning-mysql.html

That aside, I am presuming its the structure of your requests. Try keep your call into very few requests (1-10) and handle the data as a lump sum. Doing Many requests can hinder the system and drastically reduce that performance. Your server has more than enough ram and processing power.

Thats the best i can offer for now.

Altri suggerimenti

Look at MySQLTuner-0.6. It is on codeplex. It gave me a huge amount of hints in optimizing our environment.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top