6

I have a server that is running mysql and it's using a lot of memory. I run:

mysql > show status like '%onn%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| Aborted_connects         | 4     |
| Connections              | 98609 |
| Max_used_connections     | 20    | 
| Ssl_client_connects      | 0     |
| Ssl_connect_renegotiates | 0     |
| Ssl_finished_connects    | 0     |
| Threads_connected        | 1     |
+--------------------------+-------+

But then if I run 'show processlist' as the root user I don't see anything. I've tried google for this but It always comes up with stuff related to connection errors. Could someone please just explain why I can't see the connections and how to actually go in and see them?

PersianGulf
  • 10,728
  • 8
  • 51
  • 78
Cody
  • 245
  • 1
  • 9
  • 3
    Connections is total number of connections since the server started, not the current number of connections. –  Nov 03 '14 at 18:36
  • Well that explains one thing, but it still stands that the server is using huge amounts of RAM with no appearance of anything happening? I have to manually reboot the MySQL server to clear it all our but I don't think that's a very good way of solving the problem. – Cody Nov 03 '14 at 18:45
  • 1
    This doesn't help you, but my MySQL does the same thing. http://stackoverflow.com/questions/1178736/mysql-maximum-memory-usage and http://serverfault.com/questions/415530/how-do-i-assign-a-memory-limit-for-mysql may or may not also help. Once MySQL requests memory, it never gives it back (many Unix apps are like that), so your max memory usage = your current memory usage. –  Nov 03 '14 at 18:57
  • Awesome those links are very informative! Thankyou! – Cody Nov 03 '14 at 19:00
  • MySQL keeps lots of stuff, like database indexes, cached in memory. – Barmar Nov 04 '14 at 22:24

2 Answers2

1

The connection parameter is a bit of a misnomer. It indicates the number of connections that have been made to the server since the server started. The one you might be interested in is Threads connected.

Otheus
  • 5,945
  • 1
  • 22
  • 53
0

You have to use ip_conntrack netfilter module, Then you can manipulate maximum connections. You have to change value of net.ipv4.netfilter.ip_conntrack_max via sysctl

PersianGulf
  • 10,728
  • 8
  • 51
  • 78