數據庫配置優化 存儲引擎主要是:innodb,計劃提供2G內存用於Mysql運行 配置文件 Java代碼 skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 512 sort_buffer_size = 16M net_buffer_length = 8K read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 16M query_cache_size = 32M query_cache_type = 1 max_connections = 1024 expire_logs_days = 10 max_binlog_size= 256M long_query_time=1 slow_query_log=1 #innodb_data_home_dir = /usr/local/mysql/data #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = /usr/local/mysql/data # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high innodb_buffer_pool_size = 1G innodb_additional_mem_pool_size = 128M # Set .._log_file_size to 25 % of buffer pool size innodb_log_file_size = 256M innodb_log_buffer_size = 8M #修改此參數,可以大幅度提高數據庫性能 innodb_flush_log_at_trx_commit = 2 #innodb_max_dirty_pages_pct = 90 #innodb_lock_wait_timeout = 120