{"id":445,"date":"2024-09-23T09:33:37","date_gmt":"2024-09-23T09:33:37","guid":{"rendered":"https:\/\/ramansaini.in\/blog\/?p=445"},"modified":"2024-09-30T06:44:54","modified_gmt":"2024-09-30T06:44:54","slug":"mysql-configuration-for-production-setup","status":"publish","type":"post","link":"https:\/\/ramansaini.in\/blog\/mysql-configuration-for-production-setup\/","title":{"rendered":"MySQL &#8211; A Guide For Production Setup Configuration"},"content":{"rendered":"\n<p>MySQL does not provide a default production setup when installed. It can serve connections and queries up to a limit and then it will start rejecting the connections. In this blog, we will explore the configuration variables that can be used to optimize the performance of the MySQL server and use the maximum resources from the server so that maximum efficiency can be brought out without increasing server size.<\/p>\n\n\n\n<p>The file we will be making changes is: <code>mysqld.cnf<\/code><\/p>\n\n\n\n<p>This file can be found at <code>\/etc\/mysql\/mysql.conf.d\/mysqld.cnf <\/code>. You can start adding the variables at the end of the file. You can also add the variables in file <br><code>\/etc\/mysql\/my.cnf<\/code> but you will need to add those variables below <code>[mysqld]<\/code> text.<\/p>\n\n\n\n<p>We will explore the variables one by one and at the end of the blog, you will find the complete file containing all the variables which can be added directly. The values used as examples are the minimum resource configuration which are tested for runtime metrics.<\/p>\n\n\n\n<p>Here\u2019s an explanation of each variable in the provided <code>my.cnf<\/code> (MySQL configuration) file:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>[mysqld]<\/code><\/h3>\n\n\n\n<p>This specifies that the following settings are for the MySQL server daemon.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Configuration:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>port = 3306<\/code><\/strong>: Defines the port on which MySQL will listen for connections (default is 3306).<\/li>\n\n\n\n<li><strong><code>socket = \/tmp\/mysql.sock<\/code><\/strong>: Specifies the socket file location used for local connections.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Connection Management:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>back_log = 50<\/code><\/strong>: Determines how many connections can be in the queue before MySQL starts rejecting new ones.<\/li>\n\n\n\n<li><strong><code>max_connections = 100<\/code><\/strong>: Sets the maximum number of simultaneous client connections MySQL can handle.<\/li>\n\n\n\n<li><strong><code>wait_timeout = 256<\/code><\/strong>: The amount of time (in seconds) a connection can remain idle before being closed.<\/li>\n\n\n\n<li><strong><code>max_connect_errors = 10<\/code><\/strong>: If there are more than this number of failed connection attempts from a host, MySQL blocks it until you flush the host&#8217;s table or manually unblock it.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Cache and Buffer Sizes:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>table_open_cache = 2048<\/code><\/strong>: Specifies how many table descriptors MySQL can keep open simultaneously. A higher number can help reduce disk I\/O.<\/li>\n\n\n\n<li><strong><code>max_allowed_packet = 16M<\/code><\/strong>: The maximum size of one packet or any generated\/intermediate string.<\/li>\n\n\n\n<li><strong><code>max_heap_table_size = 512M<\/code><\/strong>: The maximum size for in-memory tables (Heap tables).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Buffer Settings (Used for Performance Tuning):<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>read_buffer_size = 64M<\/code><\/strong>: The size of the buffer used for sequential reads (large scans).<\/li>\n\n\n\n<li><strong><code>read_rnd_buffer_size = 64M<\/code><\/strong>: The size of the buffer used when reading rows in a sorted order.<\/li>\n\n\n\n<li><strong><code>sort_buffer_size = 64M<\/code><\/strong>: The buffer size used for sorts performed during query execution.<\/li>\n\n\n\n<li><strong><code>join_buffer_size = 64M<\/code><\/strong>: The buffer used for joins that do not use indexes (improves join performance).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Thread Management:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>thread_cache_size = 8<\/code><\/strong>: The number of threads to store in the cache to handle new connections. Helps reduce the overhead of thread creation for each new connection.<\/li>\n\n\n\n<li><strong><code>thread_stack = 240K<\/code><\/strong>: The size of the memory stack for each thread.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Full-Text Search and Storage Engine:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>ft_min_word_len = 4<\/code><\/strong>: The minimum word length considered by full-text searches (useful for text-based indexing).<\/li>\n\n\n\n<li><strong><code>default-storage-engine = InnoDB<\/code><\/strong>: Specifies the default storage engine (InnoDB) for creating new tables.<\/li>\n\n\n\n<li><strong><code>transaction_isolation = REPEATABLE-READ<\/code><\/strong>: The default transaction isolation level, meaning a transaction will see the state of the database when it began, ignoring changes made by others.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Temporary Table Size:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>tmp_table_size = 512M<\/code><\/strong>: The maximum size of temporary tables that MySQL will create in memory. If the table exceeds this, it will be written to disk.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Slow Query Log:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>slow_query_log<\/code><\/strong>: Enables logging of slow queries.<\/li>\n\n\n\n<li><strong><code>long_query_time = 2<\/code><\/strong>: Queries taking longer than this time (in seconds) are logged as slow queries.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Replication:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>server-id = 1<\/code><\/strong>: A unique identifier for the MySQL server, often used for replication setups.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">InnoDB Options (For Performance and Reliability):<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>innodb_buffer_pool_size = 4G<\/code><\/strong>: The size of the buffer pool, which is the memory area where InnoDB caches data and indexes.<\/li>\n\n\n\n<li><strong><code>innodb_buffer_pool_instances = 8<\/code><\/strong>: The number of buffer pool instances. Splitting the buffer pool into multiple instances helps improve concurrency.<\/li>\n\n\n\n<li><strong><code>innodb_data_file_path = ibdata1:10M:autoextend<\/code><\/strong>: Specifies the name, size, and properties of the InnoDB system tablespace.<\/li>\n\n\n\n<li><strong><code>innodb_write_io_threads = 8<\/code><\/strong>: Number of I\/O threads used for writing operations in InnoDB.<\/li>\n\n\n\n<li><strong><code>innodb_read_io_threads = 8<\/code><\/strong>: Number of I\/O threads used for reading operations in InnoDB.<\/li>\n\n\n\n<li><strong><code>innodb_thread_concurrency = 16<\/code><\/strong>: Limits the number of threads allowed to enter the InnoDB kernel at the same time.<\/li>\n\n\n\n<li><strong><code>innodb_flush_log_at_trx_commit = 1<\/code><\/strong>: Defines the behavior for flushing the transaction log to disk. Setting it to 1 means data is written and flushed to the log after every transaction (for durability).<\/li>\n\n\n\n<li><strong><code>innodb_log_buffer_size = 1GB<\/code><\/strong>: The size of the buffer that InnoDB uses to write log data before flushing it to disk.<\/li>\n\n\n\n<li><strong><code>innodb_change_buffering = all<\/code><\/strong>: Enables buffering of different types of changes (inserts, updates, deletes).<\/li>\n\n\n\n<li><strong><code>innodb_change_buffer_max_size = 25<\/code><\/strong>: The maximum size of the insert buffer as a percentage of the buffer pool.<\/li>\n\n\n\n<li><strong><code>innodb_log_file_size = 125M<\/code><\/strong>: The size of each log file in the InnoDB log group.<\/li>\n\n\n\n<li><strong><code>innodb_log_files_in_group = 2<\/code><\/strong>: The number of log files in the group (used in a circular fashion).<\/li>\n\n\n\n<li><strong><code>innodb_max_dirty_pages_pct = 90<\/code><\/strong>: The percentage of dirty pages (pages in memory that need to be written to disk) that triggers background flushing.<\/li>\n\n\n\n<li><strong><code>innodb_lock_wait_timeout = 256<\/code><\/strong>: The time (in seconds) a transaction waits before InnoDB rolls back a transaction due to lock waits.<\/li>\n\n\n\n<li><strong><code>innodb_file_per_table<\/code><\/strong>: This enables each InnoDB table to have its own tablespace file, rather than using the shared system tablespace.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Time Zone:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>default_time_zone = +00:00<\/code><\/strong>: The default time zone for the MySQL server. This setting ensures the server operates in the UTC time zone.<\/li>\n<\/ul>\n\n\n\n<p>This configuration is tuned for performance and reliability in high-traffic or resource-intensive environments, especially for systems using the InnoDB storage engine.<\/p>\n\n\n\n<p>Below is the complete file which can be used directly in <code>my.cnf<\/code> .<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"[mysqld]\nport = 3306\nsocket = \/tmp\/mysql.sock\n\nback_log = 50\nmax_connections = 100\nwait_timeout = 256\nmax_connect_errors = 10\n\ntable_open_cache = 2048\nmax_allowed_packet = 16M\nmax_heap_table_size = 512M\n\nread_buffer_size = 64M\nread_rnd_buffer_size = 64M\nsort_buffer_size = 64M\njoin_buffer_size = 64M\n\nthread_cache_size = 8\nthread_stack = 240K\n\n\nft_min_word_len = 4\ndefault-storage-engine = InnoDB\ntransaction_isolation = REPEATABLE-READ\ntmp_table_size = 512M\n\nslow_query_log\nlong_query_time = 2\n\nserver-id = 1\n\n# INNODB options\ninnodb_buffer_pool_size = 4G\ninnodb_buffer_pool_instances = 8\ninnodb_data_file_path = ibdata1:10M:autoextend\n\ninnodb_write_io_threads = 8\ninnodb_read_io_threads = 8\n\ninnodb_thread_concurrency = 16\ninnodb_flush_log_at_trx_commit = 1\n\ninnodb_log_buffer_size = 1GB\ninnodb_change_buffering = all\ninnodb_change_buffer_max_size = 25\n\ninnodb_log_file_size = 125M\ninnodb_log_files_in_group = 2\ninnodb_max_dirty_pages_pct = 90\ninnodb_lock_wait_timeout = 256\n\ninnodb_file_per_table\n\ndefault_time_zone = +00:00\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ECEFF4\">[<\/span><span style=\"color: #D8DEE9FF\">mysqld<\/span><span style=\"color: #ECEFF4\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">port<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">3306<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">socket<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">\/tmp\/mysql.sock<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">back_log<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">50<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">max_connections<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">100<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">wait_timeout<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">256<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">max_connect_errors<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">10<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">table_open_cache<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">2048<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">max_allowed_packet<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">16<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">max_heap_table_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">512<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">read_buffer_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">64<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">read_rnd_buffer_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">64<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">sort_buffer_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">64<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">join_buffer_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">64<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">thread_cache_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">thread_stack<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">240<\/span><span style=\"color: #A3BE8C\">K<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">ft_min_word_len<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">4<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">default-storage-engine<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">InnoDB<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">transaction_isolation<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">REPEATABLE-READ<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">tmp_table_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">512<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">slow_query_log<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">long_query_time<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">2<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">server-id<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># INNODB options<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_buffer_pool_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">4<\/span><span style=\"color: #A3BE8C\">G<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_buffer_pool_instances<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_data_file_path<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">ibdata1:10M:autoextend<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_write_io_threads<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_read_io_threads<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">8<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_thread_concurrency<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">16<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_flush_log_at_trx_commit<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_log_buffer_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #A3BE8C\">GB<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_change_buffering<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">all<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_change_buffer_max_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">25<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_log_file_size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">125<\/span><span style=\"color: #A3BE8C\">M<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_log_files_in_group<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_max_dirty_pages_pct<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">90<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_lock_wait_timeout<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">256<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">innodb_file_per_table<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">default_time_zone<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">+00:00<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>MySQL does not provide a default production setup when installed. It can serve connections and queries up to a limit and then it will start rejecting the connections. In this blog, we will explore the configuration variables that can be used to optimize the performance of the MySQL server and use the maximum resources from&hellip;&nbsp;<a href=\"https:\/\/ramansaini.in\/blog\/mysql-configuration-for-production-setup\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">MySQL &#8211; A Guide For Production Setup Configuration<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","_themeisle_gutenberg_block_has_review":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[22,10,32,11],"class_list":["post-445","post","type-post","status-publish","format-standard","hentry","category-cloud-devops","tag-cloud","tag-devops","tag-mysql","tag-performance"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/posts\/445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/comments?post=445"}],"version-history":[{"count":5,"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/posts\/445\/revisions"}],"predecessor-version":[{"id":451,"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/posts\/445\/revisions\/451"}],"wp:attachment":[{"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/media?parent=445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/categories?post=445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramansaini.in\/blog\/wp-json\/wp\/v2\/tags?post=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}