Stephan
Stephan

Reputation: 8090

Mysql decrease opened files

I was wondering if there's a way to decrease the opened files in mysql.

Details :

Solutions tried :

So any thoughts on this matter?

Upvotes: 1

Views: 9497

Answers (1)

Michel Feldheim
Michel Feldheim

Reputation: 18250

Generally, many open tables are nothing to worry about. If you come close to OS limits, you can increase this limits in the kernel settings:

How do I change the number of open files limit in Linux?

MySQL opens tables for each session independently to have better concurrency.

The table_open_cache and max_connections system variables affect the maximum number of files the server keeps open. If you increase one or both of these values, you may run up against a limit imposed by your operating system on the per-process number of open file descriptors. Many operating systems permit you to increase the open-files limit, although the method varies widely from system to system.

In detail, this is explained here

http://dev.mysql.com/doc/refman/5.5/en/table-cache.html

EDIT

To verify your assumption you could decrease max_connections and table_open_cache temporarily by SET GLOBAL table_open_cache := newValue.

The value can be adjusted dynamically without a server restart.

Prior MySQL 5.1 this variable is called table_cache

What I was trying to tell, is, that decreasing this value will probably even have a negative impact on performance in terms of less possible concurrent reads (queue get's longer), instead you should try to increase the OS limit and increase max_open_files, but maybe I just don't see the point here

Upvotes: 4

Related Questions