Skip to content
Advertisement

symmetric bandwidth usage mysql

I have 2 servers. Server A is where I have scripts that download html files from websites and then insert those texts into a MySQL server that its on server B.

Server B, at least for now, is just for Writing to MySQL, we dont read (select) to that server.

Data is downloaded using a PHP Script and another PHP Scrips opens a connection to server B a writes to MySQL using mysqli library.

By the way, the only service (that matters) running on server B is MySQL.

My problem is that server B bandwidth consumption is almost Symmetric, every data that comes in is the same that comes out, I asume its going back for some reason to server A, but I cant understand why o what is going back. If you are doing only INSERTS, the Received data should go UP and the SENT data should stay low. but this is no happeing. (See attached image showing the transfered data for MySQL)enter image description here

enter image description here

I have use VNStat and Nethogs to try debugging but I cant figure it out. For some reason MySQL is transferring some data back to server A which is costing me a lot of BW.

Any ideas of why this could be happening?

Best Regards.

Advertisement

Answer

After a long night analyzing my PHP code I found a Loop with a Mysql query inside that at first I thought it was a light query, which it was but if you add up every cicle of the loop you get a lot of data being sent to the MySQL server.

I created a better way to do that and now the BW consumption is at least half.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement