Howdy, Stranger!

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


Use of Free Memory
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.

Use of Free Memory

melfmelf Member
edited October 2011 in Help

If I were to have some free memory left for LEB suppose to serve Drupal or Wordpress, what will be the utilizing priority?

  • Increase mysql buffer / cache.
  • Increase nginx workers.
  • Increase php-fpm.

Or anything else?

Comments

  • You have to give us a baseline first. We can't tell you which one to increase because we don't know how much each one currently has.

  • It have to be analysed per instanse. At least post your stats, memory usage, number of visitors etc.

  • bretonbreton Member
    edited October 2011

    If you have a site with lots of mysql queries, then

    Increase mysql buffer / cache.

    If you have a lot of static objects,

    Increase nginx workers.

    Else if you have some calculations,

    Increase php-fpm.

    Always yours, C.O.

    Thanked by 1raindog308
  • Monitor MySQL stats, there's more than just general buffer/cache you need to worry about, things like table_cache and max_connections.

    Workers should typically stay equal to # of CPUs, just increase the max # of connections per worker process, nginx is pretty efficient.

    It doesn't hurt to increase the max # of php-fpm processes, the main php-fpm process will spawn new ones when needed, and despawn them when they're not needed. Assuming you use the dynamic pm, which you should.

  • raindog308raindog308 Administrator, Veteran

    You might want to run mysqltuner.pl (that's the URL, too) and see what it recommends.

  • melf said: Or anything else?

    If you're running on Xen or KVM then 'free' memory will be used for disk caching, so no need to worry about it :)

    But definitely run mysqltuner.pl as raindog308 suggests to ensure you've allocated enough, and not too much, memory for mysql.

  • melfmelf Member
    edited October 2011

    Thank you all for the reply and tips, at the moment I don't have something substantial to show yet, just one two sites up for the learning purpose.
    Run the script (thanks raindog308) I think I know one or two things required adjustment. Another Q please

    [!!] Temporary tables created on disk: 39% (220 on disk / 563 total)
    [!!] Total fragmented tables: 4
    

    What are those two mean?

    @breton: Thanks for your general guidelines.

  • Run an optimize table query in all your tables :P

    If you have phpmyadmin is easier :P

  • melf said: What are those two mean

    For fragmented tables, you can run OPTIMIZE TABLE [table name]; in MySQL to "defrag" the disk usage of those tables to remove the fragmentation.

    For temp tables created on disk -- it's much more complicated. There are a lot of reasons why MySQL would create temp tables on disk (rather than in memory). Basically the temp result set is too big. For some queries you can just increase the tmp_table_size, but in some cases you need to rewrite the queries.

    IIRC queries that include TEXT or other BLOB columns will usually result disk-temp table creation. Those are a lot harder to remove. For one of my heavier sites, I basically just mount a path to be tmpfs and then change tmpdir to it in my.cnf, so temp tables are most often created in memory.

  • How much space do you have in that tmpfs disk?

  • I have 1GB for my 4GB Xen VPS. However it is rarely use more than 1%...

  • So, maybe using... 100MB should be ok I guess

  • Sometimes its good to keep somethings free.

Sign In or Register to comment.