4

I want to know why we should monitor bytes sent and received on mysql ? I hope I have not asked a vague question.

Thanks.

1
  • I rarely see MySQL questions on Bytes_sent and Bytes_received. +1 for introducing these status variables in a question. Jul 1, 2013 at 21:48

2 Answers 2

6

First, let's identify each status variable:

  • Bytes_received: The number of bytes received from all clients.
  • Byte_sent: The number of bytes sent to all clients.

The only place I can think of where these number would make sense would be in the network. These status values represent the amount of data passing in and out of DB Connections. These bytes would most likely be visible from another perspective: the Operating System.

You could measure the amount on incoming/outgoing traffic in netstat against MySQL's view of it. If the amount of incoming data is low, or if the amount of outgoing data from MySQL is significantly higher than netstat says, check MySQL and/or the network. You may also want to look for any signs of dropped packets along any interfaces.

In light of this, when it comes to tuning, the only thing I can think of that you may want to tune is setting two things:

What is a MySQL Packet ?

According to the page 99 of the Book

Understanding MySQL Internals

here are paragraphs 1-3 explaining it:

MySQL network communication code was written under the assumption that queries are always reasonably short, and therefore can be sent to and processed by the server in one chunk, which is called a packet in MySQL terminology. The server allocates the memory for a temporary buffer to store the packet, and it requests enough to fit it entirely. This architecture requires a precaution to avoid having the server run out of memory---a cap on the size of the packet, which this option accomplishes.

The code of interest in relation to this option is found in sql/net_serv.cc. Take a look at my_net_read(), then follow the call to my_real_read() and pay particular attention to net_realloc().

This variable also limits the length of a result of many string functons. See sql/field.cc and sql/intem_strfunc.cc for details.

Given this information, you may want to

0
1

Bytes received: The values indicates the amount of incoming network traffic to the MySQL server Bytes sent: The values indicates the amount of outgoing network traffic from the MySQL server

You can determine the network bandwidth between MySQL server and Clients. You can record this variable value periodically for debugging purpose in the events like if you observe high activity on server, high network I/O etc...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.