Jump to content

High Performance Tips


Recommended Posts

innodb_flush_log_at_trx_commit=2

is a lot faster than 1 and safer than 0. I use it since a loooong time and have no problems with it, and my mysql is at least 3 times faster and allows heavier load without getting sluggish (Not using a SSD). For SSDs it should not make a big difference, but for traditional HDDs it does.

Link to comment
Share on other sites

  • Replies 100
  • Created
  • Last Reply

Top Posters In This Topic

Another way to improve mysql seems to use thread cached mallocs developped by google.

Install and add "LD_PRELOAD="/usr/lib/libtcmalloc.so"" in your mysqld_safe (fully recompile mysql with this new malloc).

http://google-perftools.googlecode.com/svn/trunk/doc/tcmalloc.html

Well, first, it's a comparison against glibc 2.3 from 2002-2003, current glibc is 2.9 (2009-2010). Second - using LD_PRELOAD is not "compilation". It's just a dynamic linking.

When you compile a "dynamic executable", you can't run it alone. When you double click it (or launch some other way), a special program called "loader" is launched (/lib/ld*.so). This loader loads things like libc (glibc), libdl, libcrypt and all the libraries the binary was "soft linked" with (by the compiler at compilation time) and does the actual linking at runtime.

An example list (for mangos-worldd) follows:

$ ldd /opt/mangos/bin/mangos-worldd
       linux-vdso.so.1 =>  (0x00007fff217ff000)
       libACE-5.6.6.so => /opt/mangos/lib/libACE-5.6.6.so (0x00007f10aaa8b000)
       libmysqlclient_r.so.16 => /usr/lib/libmysqlclient_r.so.16 (0x00007f10aa65f000)
       libz.so.1 => /usr/lib/libz.so.1 (0x00007f10aa447000)
       libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x00007f10aa1f2000)
       libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x00007f10a9e51000)
       libtbb.so.2 => /opt/mangos/lib/libtbb.so.2 (0x00007f10a9c2a000)
       libtbbmalloc.so.2 => /opt/mangos/lib/libtbbmalloc.so.2 (0x00007f10a9a14000)
       libmangosscript.so.0 => /opt/mangos/lib/libmangosscript.so.0 (0x00007f10a980c000)
       libpthread.so.0 => /lib/libpthread.so.0 (0x00007f10a95ef000)
       libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f10a92db000)
       libm.so.6 => /lib/libm.so.6 (0x00007f10a9059000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f10a8e42000)
       libc.so.6 => /lib/libc.so.6 (0x00007f10a8ae1000)
       libdl.so.2 => /lib/libdl.so.2 (0x00007f10a88dd000)
       librt.so.1 => /lib/librt.so.1 (0x00007f10a86d4000)
       libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007f10a849d000)
       libnsl.so.1 => /lib/libnsl.so.1 (0x00007f10a8285000)
       /lib64/ld-linux-x86-64.so.2 (0x00007f10aae56000)

So the trick with LD_PRELOAD is in adding another library to this list, making it override already defined functions. This way you can force any application to use a network proxy by changing it's network stack (google for proxychains), use chroot as normal user (google for fakechroot) and do many other things like using libtcmalloc, if it's really that faster and doesn't break your application.

Link to comment
Share on other sites

Let it run for a while. If it runs go with this. When mysql starts to act slow then go to your config and start changing. Only thing i can point out is innodb settings

innodb_buffer_pool_size=1G
innodb_additional_mem_pool_size=128M
innodb_log_file_size=128M
innodb_log_buffer_size=16M
innodb_flush_log_at_trx_commit=1

But i think that DB for 600 testers online is a little bigger then 1gb.

Hello,

Thanks Diablox again. There is a problem, if I set innodb_log_file_size=128M, MySQL server will not start, any idea why??? I have to set it = 190M or it will not start at all

Link to comment
Share on other sites

  • 2 months later...

Hello

I got a dedicated machine for my DB:

Linux host 2.6.32-25-generic #45-Ubuntu SMP Sat Oct 16 19:52:42 UTC 2010 x

86_64 GNU/Linux Ubuntu 10.04.1 LTS

I have tried to install Percona, but there seems to be something wrong, It appear that InnoDB isnt fully installed or something like that, when I check my.cnf there isnt any configuration for innodb and I have to manually add them.

Someone know what happened? Or I have to manually configure the my.cnf file?

======EDIT==========

I have manually added the my.cnf configs that where missing, but I have to remove the innodb_data_file_path for mysql to work, what do you know of this config? It is recommended to have it added or not? If yes how to add it having MySQL working right?

Also now that I have two servers, one with unix for DB, and one with Windows for core, where do you recommend me to have the website scripts? Like armory, manager and some player tools? On core server or on db server?

Regards.

Link to comment
Share on other sites

my.cnf become with default configuration and you need write your config with posted examples. You dont need remove innodb_data_file_path... at first config of innodb remove ib* files from /var/lib/mysql, and when mysql start will recreate then again with your config.

IMPORTANT: Never do it with a production innodb tables in DB, you only can remove innodb files with a clean DB without innodb tables... if you want to change some important config of innodb, you need dump all your data, remove files, change config, restart mysql, and reimport all.

To webservices... a LAMP in linux is the best solution =)

Best regards

Link to comment
Share on other sites

  • 2 months later...

checking for ACE... yes
checking ace/Stack_Trace.h usability... yes
checking ace/Stack_Trace.h presence... yes
checking for ace/Stack_Trace.h... yes

and when I compile...

Making all in realmd
make[3]: se ingresa al directorio `/home/kero/mangos/objdir/src/realmd'
 CXX    AuthSocket.o
 CXX    BufferedSocket.o
 CXX    Main.o
 CXX    RealmList.o
 CXX    PatchHandler.o
 CXXLD  mangos-realmd
../shared/libmangosshared.a(Threading.o): In function `ACE_Thread::keycreate(unsigned int*, void (*)(void*), void*)':
/usr/local/include/ace/Thread.inl:23: undefined reference to `ACE_OS::thr_keycreate(unsigned int*, void (*)(void*), void*)'
../shared/libmangosshared.a(Threading.o): In function `~ACE_TSS':
/usr/local/include/ace/TSS_T.cpp:35: undefined reference to `ACE_OS::thr_key_detach(unsigned int, void*)'
/usr/local/include/ace/TSS_T.cpp:35: undefined reference to `ACE_OS::thr_key_detach(unsigned int, void*)'
../shared/libmangosshared.a(Util.o): In function `ACE_Thread::keycreate(unsigned int*, void (*)(void*), void*)':
/usr/local/include/ace/Thread.inl:23: undefined reference to `ACE_OS::thr_keycreate(unsigned int*, void (*)(void*), void*)'
/usr/local/include/ace/Thread.inl:23: undefined reference to `ACE_OS::thr_keycreate(unsigned int*, void (*)(void*), void*)'
/usr/local/include/ace/Thread.inl:23: undefined reference to `ACE_OS::thr_keycreate(unsigned int*, void (*)(void*), void*)'
/usr/local/include/ace/Thread.inl:23: undefined reference to `ACE_OS::thr_keycreate(unsigned int*, void (*)(void*), void*)'
/usr/local/include/ace/Thread.inl:23: undefined reference to `ACE_OS::thr_keycreate(unsigned int*, void (*)(void*), void*)'
../shared/libmangosshared.a(Util.o):/usr/local/include/ace/Thread.inl:23: more undefined references to `ACE_OS::thr_keycreate(unsigned int*, void (*)(void*), void*)' follow
../shared/libmangosshared.a(Util.o): In function `~ACE_TSS':
/usr/local/include/ace/TSS_T.cpp:35: undefined reference to `ACE_OS::thr_key_detach(unsigned int, void*)'
/usr/local/include/ace/TSS_T.cpp:35: undefined reference to `ACE_OS::thr_key_detach(unsigned int, void*)'
collect2: ld returned 1 exit status
make[3]: *** [mangos-realmd] Error 1
make[3]: se sale del directorio `/home/kero/mangos/objdir/src/realmd'
make[2]: *** [all-recursive] Error 1
make[2]: se sale del directorio `/home/kero/mangos/objdir/src'
make[1]: *** [all-recursive] Error 1
make[1]: se sale del directorio `/home/kero/mangos/objdir'
make: *** [all] Error 2

Any help?

Link to comment
Share on other sites

I need your advice which is better to for max number simultaneous players.

Should I use mangos on windows (I assume multithreading work on windows) or unpatched on linux (to many bugs still in multithreading).

Computer for mangos has quad core i7 processor and 24GB ram

I have MySQL DB on separate computer.

Would multithreading mangos on windows be faster than non-multithreading mangos on linux?

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
  • 2 months later...

You can (in mysql 5.5) dedicate "all" memory to the mysql server, so it will keep all databases in the memory, and that would reduce the harddrive loat ALOT, so if you have a dedicated mysql server then upgrade to 5.5 and use innodb (read from mysql documentation)

- LilleCarl

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use