pBlueG / SA-MP-MySQL

MySQL plugin for San Andreas Multiplayer
BSD 3-Clause "New" or "Revised" License
196 stars 80 forks source link

Debug log is painfully slow #229

Open Misiur opened 4 years ago

Misiur commented 4 years ago

My startup time went up to hours due to log being written slowly

erfanasbari commented 4 years ago

I Think It's because the logging steps are these:

  1. open file
  2. add log line
  3. save file
  4. close file

and that will cause slow logging.

if you open server_log.txt and change something and save it while the server is running you will get the error: the file is open in another program and that's why server log doesn't take much time but this plugin logging does !

maddinat0r commented 4 years ago

Writing to log files happens in another thread, so that maybe hints at a slow machine (slow disk I/O, slow CPU) being the real bottleneck here. The log file being opened and closed doesn't have a huge performance overhead, so that's an unlikely cause here.