I have a CentOS 7 server.
Since a few days the server behavior has been critically slow due a lot of mysql querys in the web app we have there.
I´ve tried to setup mariaDB server.cnf to log the slow-querys and the general-querys whitout having any response or log, I don´t know why it isn´t log any query.
Please help...
The setup for the logs is rather convoluted.
You also need
log_output = FILE
Related
Good morning to everybody, I would like to ask about a problem I have and which I'm not able to solve it.
I have two servers, one is the web server (it contains a large web application) and the other one is the BD server.
The problem is that both are virtualized in a physical server with VMWare and they were running correctly until two weeks ago. In the start of this month we noticed that the web application ran very slow and we started to investigate what was the problem. We have tried a lot of things and we do not know what is the problem and, of course, how to solve it.
Both servers has an internal IP and only web server is accessible from Internet. Only web server access to BD server in order to get the results of queries. It's true that web server and BD server has an older versions of PHP and MySQL respectively.
We did the following tests:
Analyze the consumption of both servers. They are in 1% of memory, swap and al types of consumptions. Our physicial server is new from a year ago and both virtual servers does not use more than 5% of their resources.
Reboot both servers
Reboot physical server (VMWare server)
Restore a backup from 1 and 2 months ago of both servers to discard code and BD data errors
Review code (we do not touch code from before the error)
We did some queries from terminal's webserver and they were fast. We looked for the BD log and we could see that queries have been doing one by one in a "slow" velocity (0,5s for query aprox, depending on the query it can be more than a second).
We suspect that PHP is doing something bad, but we do not touch the code and we do not update PHP version or MySQL version. We want to try to update MySQL version in a new virtual machine and migrate all the data there, but we think it will not solve the problem.
The connection between servers is perfect and we think that layer 2 should not be the problem. In the same webserver we have another web application (Moodle) that connects to this BD server too, and it does not have this problem...
What can be the problem? It's very strange this change of behaviour of the web application. We were on holidays on August and we returned and we found this problem.
For more information we use PHP 5.6.40 (webserver) and MySQL Ver 14.14 Distrib 5.1.60, readline 5.1 (BD server). (yes, we know they are old versions but the web application and BD are old too)
I hope someone can help us, we are a little bit lost.
Thanks for your help!
I'd try updating your servers for one, issues like these are commonly caused by older software.
I'd also start logging or looking into loads so you can determine whatever causes the slow speeds you're getting.
Webapp goes offline randomly, the offline time is less than 2minutes. (Because the downtime checker intervals are set for 2 min test and it isn't reporting this). But users are complaining about unavailability.
Getting various alerts in phpMyadmin doubts this is something related to a MySQL connection drop.
Here are the alerts that are displayed in phpmyadmin:
Configuration.
ubuntu 16.04LTS up to date
CloudFlare enabled
PHP version: 7.0.30-0ubuntu0.16.04.1
Apache
MYSQL Server version: 5.7.23-0ubuntu0.16.04.1
Looking these values it seems your tables aren't indexed (properly). Without knowing enough about your application my best bet would be:
Restart MySQL server (this is a must)
Monitor these values after restart
Enable and examine slow query logs, thus identifying queries causing these issues
Run EXPLAIN on these queries and try to introduce proper indices
Sometimes when i am trying to connect to my server through filezilla i am getting this error at the same time my site and phpmyadmin is also down and getting errors like this mysql error: MySQL server has gone away or some times too many connections. It was working fine for last two days. 2 days before i altered tables in my database added some code in my .inc files (ie, php code) after that only i am having this problem. But some times i can connect to server and both my site and phpadmin is also loaded. I would like to know whether bad php codes can cause this(Error:Connection timed out) type of errors in FTP? Please help me..
SOLVED
Problem was with the server and they have corrected it. Thanks a lot
to all of you who responded to my question
Seems like your code is establishing too many MySQL connections, can you add the code to your question to confirm? (Do you have a DB connection in a loop by any chance?)
Regarding post-rollback errors, as you have not stated what you have tried, here is a slew of possible solutions.
MySQL #2002 forum post - A few possible solutions here.
linuxquestions forum post - (setting 'socket = /var/lib/mysql/mysql.sock' in my.cf)
'Solve: Can’t connect to local MySQL server through socket /tmp/mysql.sock'
The basic problem is most likely that you do not have the socket set correctly, check where the .sock is and what is currently set to in your settings.
Aside: You could go for a clean install of LAMP / XAMPP / whatever, may end up being quicker if possible assuming you can't fix the issue itself.
I have two servers, both running CentOS 5.7 and cPanel-CURRENT. One is x86 and the other is x64. Both are using Apache 2.2.21, PHP 5.3.8 and MySQL 5.1.
If I query the local database on any one of the servers, the results are returned instantly. In this instance a few thousand results are being returned. However running the same query from one server to another and the query takes 10+ seconds to complete.
If I use MySQL Workbench 5.2 to query the remote database from my workstation with the same query, it completes in less than a second, which makes me think there's a problem with PHP or something else server-related.
Has anyone else encountered this issue before and know how to resolve it? Any help would be greatly appreciated.
First guess:
It might be a DNS issues and you may use --skip-name-resolve option in my.cnf or you may use only IP addresses in the MySQL grant tables.
Second guess:
It might be a problem with the security level and I suggest to temporarily disable selinux or the firewall and run the test again.
I had this exact issue with a PHP/MySQL application.
Just wanted to share that adding "skip-name-resolve" to my.ini fixed it for me. I was a little confused by this since my application on desktop 1 was accessing desktop 2 (mysql) using IP address. I am going between two Windows 7 desktops.
I have a standard php app that uses SQL Server as the back-end database. There is a serious delay in response for each page I access. This is my development server, so its not an issue with the live setup, but it is really annoying for working on the system.
I have a 5 - 8 second delay on each page.
I am running SqlServer 2000 Developer Edition on a Virtual Machine (Virtual PC).
I have installed SqlServer on my development machine but get the same delay.
I have isolated the issue to the call to mssql_connect (calling mssql_pconnect has no effect)
It is a networking issue on how I have set up (or not set up, since I didn't really change default config) SQL server. It's not a strictly a programming issue but I thought I might get some valuable feedback here.
Can anyone tell me if there is a trick, specific set of protocols, registry setting, something that will kill this delay?
I was also experiencing a 5-10 second delay on every connect, using the official Microsoft SQL drivers for PHP (as suggested by #gaRex) - none of the answers posted here solved it for me.
As suggested by #ircmaxell, my problem was a DNS issue - and the solution was to edit the \windows\system32\drivers\etc\hosts file (your local local host file) and add the name of my own machine to it.
In the "system properties" dialog, find the "computer name" of your machine - then add a line like 127.0.0.1 my-computer to your local host file.
For me, the delay occurred once more, on the following attempt to load the page - after that, it was super fast, no delay at all.
Note that this problem may occur even on a physical machine, not only on a VM.
I came across network issues when running virtual pc, everything network related is slow, try adding this entry on your registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Create new DWORD value named DisableTaskOffload and set its value to 1.
Restart the computer.
It worked for me, source.
Is it perhaps a DNS issue? I know that MySQL does a reverse DNS lookup on each login (not each connection). If you don't have a reverse dns record for your server (or your dns is slow) it can cause a major delay at login. There's an option in MySQL to disable that. I'm not sure about SQL Server, but I'd assume it may be doing something similar...
I remember the same problem, but forgot, how we have solve it.
To clarify please specify exact connect strings, your SQLserver versions and also try to start this old good utility c:\WINDOWS\system32\cliconfg.exe, which is also can bring some light.
Yes, I know, it's from 2k, but guys at m$ don't like to create client tools from scratch.
Also try to get "right" mssql client dlls for PHP.