Accelerating MySQL on Ubuntu Server 22.04.3 by moving the database into RAM. #46

Speeding up MySQL by moving it to RAM
To speed up mysql performance, just change its location on the host
to control the speed, write 100,000 rows to the database
server on lga 1156 platform with xeon x3460 processor
mysql tables are stored on the hard drive (disks, there is a raid there, of course)
load control using htop and lm-sensors utilities, php script for writing to a table on a blue background
When writing to mysql tables, system resources are not actually loaded
the only thing that lasted a long time was the recording time, in the end it was 4 hours 28 minutes
make a request and make sure that 100,000 lines are written
The recording speed is on average 6 lines per second
links to articles describing the transfer of mysql to RAM in the links under the video
there is even a recommendation for automating the process and ways to return everything back
personally I just reinstalled MySQL
create a folder to store tables in RAM
sudo mkdir /tmp/tempramdisk
we mount the catalog and, at the same time, allocate the maximum available space for tables
sudo mount -t tmpfs -o size=5G tmpfs /tmp/tempramdisk/
Places are not reserved all at once, but as needed
transfer tables to RAM
sudo mv /var/lib/mysql /tmp/tempramdisk/mysql
create a symbolic link to the disk in RAM
sudo ln -s /tmp/tempramdisk/mysql /var/lib/mysql
grant mysql rights to act on the mounted disk
sudo chown mysql:mysql /tmp/tempramdisk/mysql
restart mysql server
/etc/init.d/mysql restart
run a server status check similar to the control one
thread load tends to 40%, an additional 350 megabytes are occupied in RAM
It took 37 seconds to record
we check how many lines are written and find out that it is also 100000
the number of lines written to the table is 3283 per second
the speed increase was THREE ORDERS of orders (!!!)
the first and main conclusion is that you can get a big performance boost on any hardware
It’s enough just to think about how and where the processor communicates with the data
sources of inspiration:
unlix.ru/%D1%83%D1%81%D0%BA%D...
timeweb.cloud/docs/unix-guide...
sovetbati.pro/kak-razmestit-v...
в озвучании:
To Pass Time - Godmode
Retrograde - Spence

Пікірлер