MySQL and low memory(?), help needed

Dear lazyweb,
as you may have seen sometimes the SQL backend of this blog dies.
I believe this is caused by the amount of ram available on the machine, but feel free to teach me.
Right now mysql uses

PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
23902 mysql 18 0 42M 28M sigwait 0:12 0.83% 0.83% mysqld

I tried to optimize it a little, but had small to none real effect using

query_cache_type = 1
query_cache_size = 1M
query_cache_limit = 1M
thread_cache_size = 3
tmp_table_size = 50000000
key_buffer_size = 6291456

Given that all I have are 192Megs of ram, and the machine is performing happiliy if it weren’t for the DB dying, is there anything I can do? (“Move over to a bigger iron” is not a valid answer).
I think I’m not using InnoDB, and that all tables are MyISAM – if that makes a difference.
I’m on 5.0.2x train already.

In other news, I’m @home in Bologna and I have fever.
It won’t be fun to reach Milan tonight or tomorrow morning. :|

Author: zen

Geek of all trades, having fun with *NIX, the Internet and computer security since 1995.

6 thoughts on “MySQL and low memory(?), help needed”

  1. I parametri di ottimizzazione della memoria di mysql sono veramente tanti.
    Nel tar.gz che trovi sul sito di mysql ci sono anche delle configurazioni prefabbricate per macchine molto piccole.

    Prova a darci un occhio.

    Altrimenti a questo link dopo la lista dei parametri che puoi configurare trovi degli esempi per macchine con poca memoria.

    http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html

    Ciao

  2. @andy: si` che sono miei quei 42Mb… perche`?
    @antonio: ho letto e provato ad applicare i parametri per le macchine con poca ram, ora lo lascio andare per un po’ e vediamo cosa succede.
    Allo startup pare che non ci sia molta differenza

    PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
    28560 mysql 18 0 35M 27M sigwait 0:08 1.22% 1.22% mysqld

    ma pare cmq che vada meglio. Time will tell.
    grazie!

  3. I parametri per il fine tuning di mysql sono veramente tantissimi, per fare un setup decente bisogna adattarli al tipo di database che il DBMS deve gestire e alle risorse fisiche.
    Quindi dando per certo che la base di dati sia progettata in modo corretto e che le query siano abbastanza ottimizzate ti consiglio di agire sui parametri di ottimizzazione in base ai valori delle variabili di sistema, con SHOW STATUS noti al volo quali sono le variabili sballate.

  4. Tipicamente quando la configurazione un dbms non e` ottimizzata i parametri che ne denotano il suo stato possono essere sballati di brutto, il tutto si vede con show status.
    Ad esempio nel caso di parametri sbagliati della cache si vede con:
    SHOW STATUS LIKE ‘qcache%’;
    Per la dimensione dei buffer:
    SHOW STATUS LIKE ‘open%tables’;
    Oppure alla easy way con phpmyadmin nella schermata delle variabili di stato quelle con valori critici vengono messe in rosso, e uno sa dove intervenire.

    http://www.ibm.com/developerworks/library/l-tune-lamp-3.html
    http://www.lonerunners.net/blog/archives/990-Tuning-and-Optimizing-Performace-of-MySQL.html

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close