We process and house incredible amounts of data inside MySQL servers running on Ubuntu 10.04 and distributed across an HP P4500 Left hand SAN array.
We are fed a constant stream of data from a
StormMQ cluster and we process around 7,000,000,000 inserts per week and extract hundreds of gigabytes of data.
I will cover our use of message queuing in more detail in a later post.
The problem:
Over time our data has grown to many terabytes and this has started to affect performance negatively. When doing a single operation we saw normal performance but concurrency became a real struggle.
Thanks the de-coupled nature of our system we could afford to insert data at a reduced rate because our data would queue and wait to be processed, but our data extraction has to be fast.
The Fix:
Over the last month we have worked through our set up to try and meet the performance levels that we expect from the hardware we are running.
After investigating all the usual suspects; low performance, MySQL configs, hardware, networking, SAN performance and compatibility we were left scratching our heads a little.
We were hammering our servers with data and our SAN did not seem to under any load yet we where unable to pull the kind of speeds we needed.
One of the things we wanted to look at was the
Open-iSCSI initiator. We started by checking the compatibility matrix for the P4500 which showed Open-iSCSI as officially compatible.
Next we used some google-fu to research Open-iSCSI settings and possible changes. To our surprise this threw up nothing of real value, prompting us to speak with other SAN and Linux engineers to find out how they tuned Open-iSCSI,. Again we were surprised that most people use the defaults and this was sufficient for most cases.
There was nothing left to but team up and experiment with Open-iSCSI and see if we could push our SAN harder. I started by flying to Kansas City MO to meet with Chris Mende from HP (
@csmende) and get set up.
We got to work on setting up close monitoring on key system variables and put our system into a state that was safe to test in.
This is a live system with hundreds of distributed systems sending us data and in any normal set up shutting down would require a maintenance window, or a managed loss of data.
At Smith we don’t see the loss of one byte of data as an option, this we why we message queue.
I brought down our data processing applications on the application servers and left StormMQ to queue up all our data and safe guard our bits and bytes.
Next we decided on the key performance metrics we wanted to record and monitor to best analyze the effect of our changes.
For MySQL we chose concurrent query time and insert rate. For the P4500 we chose IOPS, throughput and Qdepth.
To gather this information we used a combination of HP centralized management console. Mytop, MySQL server output, Cacti, and our own in house developed systems.
Initial recording to define the problem :
As you can see our inserts per second (NOIPS) take a dive along with our Qdepth as soon as we start our selects.
So now it’s changes time. We started by running our tests with the Open-iSCSI default config:
Next we looked at the node.session.cmds_max and node.session.queue_depth settings in /etc/iscsi/iscsid.conf
The default value for these settings with Open-iSCSI is:
node.session.cmds_max = 128
node.session.queue_depth = 32
However we knew from experience that the default max commands per session setting the Microsoft Iscsi initiator is 256, we also knew this setting can could be pushed so we went straight for a values of:
node.session.cmds_max = 1024
node.session.queue_depth = 128
After this change our results were:
These figures looked good so we started up our data imports and ran some big selects:
Success!! We have achieved true concurrency with inserts and selects. So editing our Iscsi config has worked.
Note: Between each test we disconnected from the target and restarted Open-iSCSI.
We are now inserting at an even more incredible rate. This is not just down to our iSCSI config however, we have a very highly tuned MySQL set up coupled with a message queue.
I will follow up on all of these in later posts.