Posts Tagged 'Managed Services'

June 8, 2011

MySQL Slow? Check for Fragmentation.

Let's say you have a website and you notice that any calls to your MySQL database take longer to render. If you don't have a Database Administrator (DBA), this can be pretty frustrating. SoftLayer's Managed Hosting line of business employs some of the best DBAs in the country and is one of the only managed hosting providers that offers MySQL and MsSQL DBA services, and I don't just say that because I'm one of them ... We've got the certifications to prove it. :-)

Given my area of expertise, I wanted to share a few some simple tips with you to help you tweak variables and improve the performance of your MySQL server. Given that every application is different, this isn't necessarily a one-size-fits-all solution, but it'll at least give you a starting point for troubleshooting.

First: Get This is a fine script by Major Hayden that will give you some valuable information regarding the performance of your MySQL server.

Second: Look for fragmented tables. What are fragmented tables? If there are random insertions into or deletions from the indexes of a table, the indexes may become fragmented. Fragmentation means that the physical ordering of the index pages on the disk is not close to the index ordering of the records on the pages or that there are many unused pages in the 64-page blocks that were allocated to the index. The symptoms of fragmented tables can be that table can take more disk space than needed or the results may return slower with more disk I/O than needed. INNODB users need to check the fragmentation often because when INNODB marks data as deleted, it never overwrites the blocks with new data ... It just marks them as unusable. As a result, the data size is artificially inflated and data retrieval is slowed.

Fortunately, there is a way to see your table fragmentation and that is to run a query against the information_schemea to show all tables that are fragmented and the percentage of fragmentation:

SELECT TABLE_SCHEMA, TABLE_NAME, CONCAT(ROUND(data_length / ( 1024 * 1024 ), 2), 'MB') DATA, CONCAT(ROUND(data_free  / ( 1024 * 1024 ), 2), 'MB')FREE from information_schema.TABLES where TABLE_SCHEMA NOT IN ('information_schema','mysql') and Data_free < 0;

Fixing the fragmentation is easy, but there are a few caveats. When defragmenting a table, it will lock the table, so make sure you can afford the lock. To fix fragmented tables, you can simply run optimize table <table name>; to rebuild the table and all indexes or you can change the engine of the table with alter table <table name> engine = INNODB;

I have written a simple bash script in bash to go through, defragment and optimize your tables:

MYSQL_LOGIN='-u<user name> --password=<passowrd>'
for db in $(echo "SHOW DATABASES;" | mysql $MYSQL_LOGIN | grep -v -e "Database" -e "information_schema")
        TABLES=$(echo "USE $db; SHOW TABLES;" | mysql $MYSQL_LOGIN |  grep -v Tables_in_)
        echo "Switching to database $db"
        for table in $TABLES
                echo -n " * Optimizing table $table ... "
                echo "USE $db; OPTIMIZE TABLE $table" | mysql $MYSQL_LOGIN >/dev/null
                echo "done."

You'd be surprised how much of an impact table fragmentation has on MySQL performance, and this is an easy way to quickly troubleshoot your database that "isn't as fast as it used to be." If you follow the above steps and still can't make sense of what's causing your database to lag, our Managed Hosting team is always here to work with you to get your servers back in shape ... And with the flexibility of month-to-month contract terms and the ability to add managed capabilities to specific pieces of your infrastructure, we have to earn your business every month with spectacular service.


May 9, 2008

Industry-Wide Language Barrier

What language do we speak here at Softlayer? What language is spoken across the industry? Is it the same, or does everyone have their own code for translation?

It seems that in the “on demand datacenter industry”, “hosting industry”, “dedicated server industry” (or whatever you prefer to call it) each company or provider has its own idea and way of projecting who they are. These projections are seldom in line with one another and have a slight difference only to give some idea of separation.

The biggest grey area that I have seen and something that gets distorted is the idea of managed services and just the term “management” in general seems to have lost any kind of universal meaning. The thing that I run into most is when a customer asks us if we are a managed company. I find this to be a loaded question knowing what I know of the industry and other providers. The reason is that you can call your service anything you want to and even come up with clever and creative names for it, but at the end of the day creative marketing doesn’t get results when the rubber meets the road.

It is imperative that the correct expectations are set so that customers aren’t lead astray and find themselves in a situation that they were unprepared for because they were disillusioned by gimmicky wording. Softlayer has the reputation of being an honorable company and I am proud to be a part of that. We do not consider ourselves to be a managed service, but we do offer support and help in many situations. We have support staff here 24 hours every day of the year that can help you, or possibly help point you in a good direction for you to be able to help yourself. We offer OS updates and patches at no additional charge automatically. We strive to be as upfront and fair on everything from the bottom to the top, so I feel that it is my duty to explain this situation in more detail. In fact, all of our sales representatives and many of our customers have felt this same way. What I have found is that this upfront and honest explanation is a rarity and that many companies are not as forthcoming as they could be or should be when discussing “managed services”.

There are a lot of companies who provide the exact same services as we do and call this being “fully managed”. There are others who promise the moon and a shoe shine with their service and then just come up short on the efforts. Now, this may not be entirely their fault because they may have excellent intentions, but a poor and impractical business model. However, intentions don’t get results and customers are the ones who pay most for the misrepresentation. The worst situation is when someone pays a huge premium for a service that is overpromised and then severely under delivered. When I am able to talk to someone who has been in this situation they really appreciate the options and control that they have over every aspect of their service when choosing Softlayer as their provider. The only satisfaction I can get is helping people that have been taken advantage of find a provider that they know they can count on and exactly what they can expect.

This elaboration of services extends beyond server management. No matter what buzz words a company may want to use to describe your company (“largest”, “best”, “heroic”, “ultimate”, really just fill in the blank on this if you’ve been around long enough.) the main thing that matters in this industry is functionality. I am confident in saying that no other company can offer anything close to what Softlayer can provide. Softlayer provides options and capabilities which are unparalleled in the industry in order to give customers complete control over their hardware and thus their own business. There are some that have tried to copy our model and others who have tried to produce a stop-gap solution between what they offer and what we offer, but they have failed. Is this, perhaps, a key reason why we have been able to sustain our high level of growth and remain stable? Possibly. Is this a sign that the best is yet to come with Softlayer? Definitely.

If you want to talk about situations or projects you may have coming up, I would be happy to speak with you and help come up with a solution that will maximize your businesses potential. In fact my entire team is here for this specific purpose.


Subscribe to managed-services