Much slower MySQL performance on virtualized server - mysql

I'm in the process of both virtualizing and updating an old Linux server running a reporting system developed in house (Apache, MySQL, PHP).
The old physical server is running 64-bit Ubuntu 10.04.3 LTS, MySQL 5.1.41 and PHP 5.3. The server has an Intel Xeon CPU X3460 # 2.80GHz (4 cores), 4GB RAM.
We have ESXI 5.5 running on an HP DL380G6 with 2 x Intel Xeon X5650 6 Core 2.66ghz and 32GB RAM.
I created a new VM with 4 cores and 4GB RAM, and did a clean install of 64-bit Ubuntu 16.04.4 LTS, MySQL 5.7.21 and PHP 7.0, migrated our app, and everything is running much slower. I believe it's MySQL because when doing the same direct query on the old physical server vs the new virtualized one, queries can take 8 seconds (VM) instead of 1 (Physical). The tables all have appropriate indexes, running "EXPLAIN" on each server provides the same results, yet one is substantially slower. When a page is running numerous complex queries, it can take a minute+ to load instead of a few seconds.
Any idea why this can be? Same dataset, same query, same engine (MyISAM). The VM has much more recent versions of everything, same number of cores and same RAM. I even tried doubling the VM CPU to 2 sockets, 4 cores and 8GB RAM, and it doesn't seem to have a substantial impact.
I've compared the MySQL configuration and nothing is jumping out at me at being very different.
What might I be missing here? Is it the virtual host hardware?

Did you upgrade the vmware tools? if not do so.
Then, on this ESXi host, do you have other VMs on it? If yes, I would advise you to create a resource pool and then configure the resource limits.
In the resource pool the amount of resource you assign will be in a way reserved for your VM, so you won't have to share with other VMs.

Related

Apache and MySQL installation on VPS

Is there any difference (or preference) between two schemes:
Apache & MySQL are installed on the same VPS (4Gb RAM, 2 CPU Cores) and each of them configured for 2GB RAM,
Apache and MySQL installed on separate VPS (2Gb RAM, 1 CPU Core).
Thank you.
It is better to go for separate vps server
Following are the reason
1) can boost performance, u can balance the load equally
2) easier to set up replication if you have separate standalone DB server
3) easier to trouble shoot if there is a problem either in apache or mysql
4) normally if you have separate DB instance, you will allocate 80% of your RAM memory to Myisam or Innodb engine for better concurrency. If both kept in same vps, u will have to sacrifice concurrency, scalability

Mysql slow on windows, fast on linux. Why?

I have installed a SpringMVC Web application with JPA and a Mysql Database.
The application is displaying statistics from the database (with a lot of selects)
It works quite fast on Linux(mysql 5.5.54), but it is very slow on Windows 10 (mysql 5.6.38).
Do you know what could cause such a behaviour on Windows?
Or could you give me hints or tell me where to search?
[UPDATE]
Linux : Intel® Core™ i7-4510U CPU # 2.00GHz × 4 / 8GoRAM
Windows : Intel Xeon CPU E31220 3.1Ghz 4GoRAM
I know that the windows machine is not as "powerful" than the linux one. I wonder if, by increasing the memory, that could be enough. Or does Mysql needs a lot of CPU too.
My list would be:
Check configs are identical - not just the settings in my.ini - values not set here are set at compile time and the 2 instances have definitely been compiled seperately! You'll need to capture and compare the output of SHOW VARIABLES
Check file deployment is similar - whether innodb is configured to use one file per table, whether the files are distributed across multiple disks
Check adequate memory available for caching on MSWindows
disable anti-virus
Make sure MSWindows is configured as a server (prioritize background tasks)
Windows sucks, deal with it :)

Mysql processes on Ubuntu server

When I check my process using htop on a relatively new install of Ubuntu on Linode, I see about 17 MySQL processes. None of them eat CPU, and each of them eats like 2.1% of ram.
My website isn't even running yet, I've not relocated the domain, I've just been setting up the server. Its like idle mode, and has all those processes and eats up all that ram. Is that normal?
You can specify max_connections within your mysql configuration. If your applications efficiently use/reuse connections, you probably need far fewer than 17.

mysql server overload due to many queries at once

I have an application on my server that uses many database requests to a reasonable simple and small database (10Mb size).
The number of simultaneous requests can be around 500. I have an Apache & Mysql server running on linux with 8GB RAM and 3 cores.
I've upgraded the server recently(from 512mb to 8GB), but this is not having effect. It seems that the aditional CPU and RAM is not being used. Before the CPU hit 100%, but after the upgrade I still get status WARN at only 40% CPU usage:
Free RAM: 6736.94 MB
Free Swap: 1023.94 MB
Disk i/o: 194 io/s
In the processes, the mysqld cpu usage is 100%.
I can't figure out what the right settings are to make the hardware upgrade work for mysql and MyISAM engine.
I have little experience with setting up and configuring a server, so detailed comments or help are very welcome.
UPDATE #1
the mysql requests are both readers and writers from a large number of php scripts.

Linux Mysql Memory requirements

I have:
32 bit - Red Hat Enterprise Linux Server release 5.1 (Tikanga)
Mysql 5
10G RAM
What are the memory allocation limits with respect to mysql?
Maximum memory usage possible.
Any supporting documents from redhat site?
As such, if your system has more than
4GB of RAM, you need to install the
... EXT3 file system capacity has been
extended beyond 8TB to a maximum of
16TB. ..... the mysqli extension, a
new interface designed specifically
for MySQL
Source: http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/release-notes/RELEASE-NOTES-x86-en.html
EDIT: It took me 3s of googleling... (did I write correctly?)