Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Mysql uses a lot of Ram and CPU
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Mysql uses a lot of Ram and CPU

From time to time mysql uses a lot of mysql and cpu. What can I do?

«1

Comments

  • Redis

  • @SirFoxy said:
    Redis

    No :)

  • DataIdeas-JoshDataIdeas-Josh Member, Patron Provider

    When it is using a lot of resources is someone doing a query?

  • exception0x876exception0x876 Member, Host Rep, LIR

    Run show processlist when it is doing it.

  • @exception0x876 said:
    Run show processlist when it is doing it.

    thanks can you let me know all ssh commands to do so?

  • WebProjectWebProject Host Rep, Veteran

    @lowfan said:
    From time to time mysql uses a lot of mysql and cpu. What can I do?

    Have you optimised the MySQL server? If the cpu is not powerful enough you do have option to offload MySQL by creating node specific for MySQL usage.

  • @WebProject said:

    @lowfan said:
    From time to time mysql uses a lot of mysql and cpu. What can I do?

    Have you optimised the MySQL server? If the cpu is not powerful enough you do have option to offload MySQL by creating node specific for MySQL usage.

    It is a 4 CPU , No I do not know how to optimize the mysql on my cpanel I have only one account in my vps

  • Use nvme ssd + litespeed Web server and cloudflare cdn.
    Also upgrade to high vps or move to dedicated server.

  • size of database? How often are queries done? Please also list CPU, storage type and RAM size of the server

  • Enable the slow query log, see what queries are taking too much time to respond.

    Thanked by 1vimalware
  • AlwaysSkintAlwaysSkint Member
    edited September 2020

    tuning-primer.sh / mysqltuner.pl , with patience and a little bit of research.
    (I ignore the query cache suggestions to turn it off: personal experience/preference.)

  • optimise your database or download more ram

  • @elliotc said:
    optimise your database or download more ram

    Where can I download ram?

  • @Jarry said:

    @elliotc said:
    optimise your database or download more ram

    Where can I download ram?

    Here

  • Every question you ask here eventually becomes a joke

  • @lowfan said:
    Every question you ask here eventually becomes a joke

    Do I get a bonus, for giving a correct response? ;)

  • @AlwaysSkint said:

    @lowfan said:
    Every question you ask here eventually becomes a joke

    Do I get a bonus, for giving a correct response? ;)

    You are chinese ? LOL your icon is a dragon !

  • AlwaysSkintAlwaysSkint Member
    edited September 2020

    @lowfan said: You are chinese ? LOL your icon is a dragon !

    Nope. Dragon 32 (Google it) which I still have in the attic!

  • Chinese allergy, but don't know Chinese
    LOL

  • You could try adjusting the innodb_buffer_pool_size

  • nbnnbn Member
    edited September 2020

    You could use PHP and use curl to do your mysql queries as a rest API instead of creating direct connections to the mysql db. Much more efficient. Try here: https://developer.okta.com/blog/2019/03/08/simple-rest-api-php

  • Also, don't do unecessary queries unless you have to. Cache the data.

  • @lowfan said:
    From time to time mysql uses a lot of mysql and cpu. What can I do?

    reboot

  • raindog308raindog308 Administrator, Veteran

    @lowfan said: Every question you ask here eventually becomes a joke

    Honestly your question is kind of a joke. "From time to time mysql uses a lot of mysql and cpu. What can I do?" No details about the workload, version of MySQL or even if it is MySQL vs. Maria, what kind of server, what apps, etc.

    Then this:

    @lowfan said: thanks can you let me know all ssh commands to do so?

    If you continue looking for magic recipes on the Internet that you can type with no understanding of what they do, you will make a soup of your system.

    You're in way over your head. Hire a sysadmin. That is the only logical answer for you.

    Thanked by 2Falzo TimboJones
  • @raindog308 said:

    Yes I know it is over my head . How much do I normally need to pay for just this kind of one time work?
    Thanks

  • Good sysadmins ask for around + 50$/hour. Below that you will get a mediocre job, unless it is someone reputable.

    looking for magic recipes on the Internet that you can type with no understanding of what they do, you will make a soup of your system.

    It has happened to me that some clients make a soup of their system, they have completely f*d up databases. Just by changing simple settings, they completely corrupt everything!

    If you are going to do it yourself, just do backups all the time of your system. Or If you want to avoid paying a sysadmin just grow your vps, more and more.

  • ReserveHostReserveHost Member
    edited September 2020

    @Hosterlabs said:
    Good sysadmins ask for around + 50$/hour. Below that you will get a mediocre job, unless it is someone reputable.

    looking for magic recipes on the Internet that you can type with no understanding of what they do, you will make a soup of your system.

    It has happened to me that some clients make a soup of their system, they have completely f*d up databases. Just by changing simple settings, they completely corrupt everything!

    Just avoid messing with the innodb_log_file_size > @lowfan said:

    @raindog308 said:

    Yes I know it is over my head . How much do I normally need to pay for just this kind of one time work?
    Thanks

    What is the specifications of the server most specifically ram amount

    Thanked by 1Shamli
  • risharderisharde Patron Provider, Veteran

    @lowfan It is really important that you give us more details on what you are running that uses mysql, perhaps an idea on the hardware specs and the visitors per hour for example so we can guess closer to an answer. As for fixing your issues, you shoild also take the opportunity to learn (easier said than done) but try to break things up logically. For example, in your issue, its not really mysql's fault per say (putting aside the argument of mysql default configuration). It is probably an honest overload of traffic that could be causing this so start with how to check whether your website (assumedly) is doing queries properly and fix if necessary. If that doesn't help, consider additional caching. If that doesn't help, considering double checking mysql table indexing. If that doesntt help, consider mysql config tweaking. If that doesnt help, chexk on system cpu and io usage. If those are maxing out, probably just a case of one server not being able to handle all the visitors in which case, you will have to split things up and that would be the start of spending more money on professional help.

  • Clearly, the solution to the problem is getting a 10x faster machine, therefore decreasing the percentage of CPU used and no visible problem anymore.

Sign In or Register to comment.