Zu viele offene Dateien im System

Fireball22

Registered User
Hallo,

leider habe ich seit heute, nach dem ich vor einigen Tagen meinen MySQL-Server etwas neu konfiguriert habe, folgendes Problem:

Code:
hxxxxxx:~# sh check_ram.sh
cat: error while loading shared libraries: libc.so.6: cannot open shared object file: Error 23
check_ram.sh: line 7: /bin/grep: Too many open files in system
check_ram.sh: line 8: /usr/bin/awk: Too many open files in system
check_ram.sh: line 9: /bin/cat: Too many open files in system
check_ram.sh: line 9: /bin/grep: Too many open files in system
check_ram.sh: line 10: /usr/bin/awk: Too many open files in system
check_ram.sh: line 11: /usr/bin/awk: Too many open files in system
check_ram.sh: line 12: /usr/bin/awk: Zu viele offene Dateien im System
check_ram.sh: line 13: /usr/bin/awk: Zu viele offene Dateien im System

Das gleiche Problem tritt bei mir fast überall auf, wenn ich irgendwas versuche in der Shell zu machen, oder auch schon in Plesk.

Code:
Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
    852677: kmemsize        6135322    6135322    8512433    9823665         10
            lockedpages           0          0       3800       4096          0
            privvmpages       76362      76362     138256     202568          0
            shmpages           5885       5885     131072     131072          0
            dummy                 0          0          0          0          0
            numproc              83         83        232        232          0
            physpages         29050      29050          0 2147483647          0
            vmguarpages           0          0      66400 2147483647          0
            oomguarpages      29398      29398      66400 2147483647          0
            numtcpsock           22         24        500        500          0
            numflock              9         10        200        232          0
            numpty                1          1         64         64          0
            numsiginfo            0          1        512        512          0
            tcpsndbuf        203476     194532    4683256    6102456          0
            tcprcvbuf        360448     344064    4683256    6102456          0
            othersockbuf      15652      18332    1503232    4063232          0
            dgramrcvbuf           0       1212     240000     262144          0
            numothersock         16         17        382        382          0
            dcachesize            0          0    2194304    2317184          0
            numfile            5376       5376       5432       5432       1335
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent            14         14        128        128          0
Der Wert von numfiles nimmt stätig neu zu, aber wie kann ich die Zahl der gleichzeitig geöffneten Dateien einschränken?

Hier mal eine Ausgabe der wichtigsten MySQL-Einstellungen:

Code:
MySQL Version 5.0.32-Debian_7etch6-log i486

Uptime = 0 days 0 hrs 0 min 45 sec
Avg. qps = 21
Total Questions = 962
Threads Connected = 1

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 5 sec.
You have 0 out of 983 that take longer than 5 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is enabled

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 1
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 1
Historic max_used_connections = 2
The number of used connections is 2% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

MEMORY USAGE
Max Memory Ever Allocated : 12 M
Configured Max Per-thread Buffers : 265 M
Configured Max Global Buffers : 6 M
Configured Max Memory Limit : 272 M
Physical Memory : 1.97 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 1 M
Current key_buffer_size = 2 M
Key cache miss rate is 1 : 11
Key buffer fill ratio = 0 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is enabled
Current query_cache_size = 2 M
Current query_cache_used = 109 K
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 5.35 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 7 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 2158 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 1024 tables
You have a total of 704 tables
You have 704 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 129 temp tables, 6% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 529 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 1205
Your table locking seems to be fine

Wie ihr seht, musste ich den kompletten Server gerade eben neu starten um überhaupt noch auf das tuning-primer-Script zuzugreifen, weshalb die Ratschläge jetzt erst einmal zu vernachlässigen sind.

Was lässt sich hier umstellen?

MfG
Michael
 
Vielen Dank für deine Antwort, darin sehe ich deutlich, dass durch den Parameter table_cache noch einige Tables geöffnet wurden.
Ich habe diese Zahl glaub von 300 auf 1024 erhöht, und nun wieder auf 512 verringert, ist das okay, oder sollte ich die noch weiter runterschrauben?

MfG
Michael
 
Wenn die Fehler wieder auftreten, wirst du sie noch weiter runtersetzen müssen, ist dies nciht der Fall, gibt es keinen Grund es weiter herabzusetzen. ;)
 
Von der Variablen table_cache haengt auch (wenn nicht separat konfiguriert) die Variable open_files_limit zusammen. Diese wird ca. auf den doppelten Wert von table_cache gesetzt.
D.h. du hast schon richtig geschlussfolgert dass das herabsetzen des Wertes in table_cache dein Problem loesen sollte (auch wen ggf. ein kleiner Performance Nachteil auftritt)

Bzw. kannst ja nachschauen wieviele geoeffnete Files MySQL im moment hat

Code:
lsof | grep mysqld | wc -l
 
Vielen Dank für dein Posting und deine Hilfe!

Im Moment sind es bei mir genau 701 geöffnete Files.
Das sollte eig. okay sein.

Allerdings frage ich mich, wie ich den Wert von open_files_limit ändern kann, denn ein zusätzlicher Eintrag in der my.cnf bringt leider hier nichts, es scheint mir fast, dass dieser Wert dynamisch verteilt wird, weil im Moment sagt mir tuning-primer, dass er auf ca. 1300 steht, jedoch verändert sich der Wert ständig etwas.

MfG
Michael
 
Back
Top