Announcement

Announcement Module
Collapse
No announcement yet.

Need HELP setting up Cluster !!!!

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need HELP setting up Cluster !!!!

    Hello All,

    I have been using Persona server "5.1" for a while now and i also have a "Percona Replication" server setup for backup, just incase....

    Now, My user base has increased a lot to 1000 users ( Yes, one thousand ) and at times my current server cannot cope up and my web server returns a 'time out' error to the users and this is causing a lot of issues.

    My company wants me to setup a cluster ( which i have never done ) and hence they have bought in a bigger muscular server, Since i have never done this before, Would any one here care in guiding me as to how can i go about this ?

    I have read the minimum number of nodes required is 3, But is also doable with 2 nodes.


    What i have now is :-

    One NEW server
    One Web Server
    Current Percona MySQL Server
    Current Percona Replication Server


    Please suggest !!

    Thank you all for your time and patience.

  • #2
    I would suggest to have an expert look at your current database servers. Maybe some smart improvements can considerably reduce the current workload.

    Comment


    • #3
      As gmouse mentioned, getting a consultant in to take a look is usually your best bet in the long run. You can easily spend a lot of money on unnecessary / unusable systems when the requirements are driven by people who know little about databases / MySQL.

      That aside, I would start by reviewing your work load. If your workload is mostly reads (often the case), then a cluster or simple replication slaves may do the trick to offload reads from the master to the slaves. If you are write heavy, that presents more of a challenge, as clusters and read slaves may not help with that, and you may have to look into sharding of some sort (difficult, complex, and can be costly). If it turns out you are read heavy, you can likely do a lot of query optimization to speed things along as well.

      So the easiest way to review this is to run "SHOW GLOBAL STATUS LIKE 'Com%'" on your database server and review each of the statement types to get an idea what your workload is and go from there.

      Comment


      • #4
        Certainly paying someone like myself to set this up for you (and help teach you how) is one option.

        A self-starter option would be to go through my PXC tutorial available for free here: https://github.com/percona/xtradb-cluster-tutorial and/or attend a conference where I give this tutorial.

        Comment


        • #5
          Scott,

          I'll follow your instructions first and try to figure out what is more ( read or write ).

          Can you let me know how long do i have to keep running this command "SHOW GLOBAL STATUS LIKE 'Com%'"
          to figure out my requirement ?

          Jayj, I'had a look at the link provided by you and shall try to flllow it and if i have problems i know where to look for you now

          I highly appreciate both of you for your valuable inputs.

          Thank you,

          Awaiting your revert Scott !!

          Comment


          • #6
            Hello Scott / Jayj

            I have run the command "SHOW GLOBAL STATUS LIKE 'Com%'" on my server during business hour and the results i got has been attached along with response.

            Can you please look into this and let me know if its heavy read or write.

            Awaiting your update.

            Thank you once again.
            Last edited by systemali; 05-09-2013, 02:19 AM.

            Comment


            • #7
              Even if it's heavy read or write, simple query optimizations may help you more than a new server.

              Comment


              • #8
                Originally posted by systemali View Post
                Hello Scott / Jayj I have run the command "SHOW GLOBAL STATUS LIKE 'Com%'" on my server during business hour and the results i got has been attached along with response. Can you please look into this and let me know if its heavy read or write. Awaiting your update. Thank you once again.
                Those status variables are cumulative while the server is up, so as long as your server has been running for a while then running them once will give you a general idea of the overall load, and then I'd run it again maybe 24 hours later to see how much it has changed in the 24 hour period.

                And yes, as gmouse mentioned query optimization is always a good thing, and often solves the majority of "load" issues that people have due to poorly written queries. You'd be surprised at how much a single MySQL server can handle when the server is properly tuned and the queries properly optimized. =)

                As for the results you posted, we can do a little analysis, but without doing a thorough review of your setup and the queries that are being ran we cannot say anything definitive.

                Based on what you posted, it looks like about 98% of the statements are selects (rough estimate), which means you are pretty read-heavy. This does not mean that writes are not still an issue, as you could be doing huge writes in a single statement, have bad disk I/O, bad database schema design, etc. that make writes painful. But you can likely make huge improvements by optimizing your select queries first, and then go from there. Use the pt-query-digest tool to review your slow query log, optimize the worse queries, and go from there.

                Statement Type Count Percent
                Com_delete 1058127 0.51%
                Com_insert 1287660 0.62%
                Com_select 202367658 97.86%
                Com_update 2061945 1.00%
                Com_update_multi 7409 0.00%
                206782799 100.00%

                Last edited by scott.nemes; 05-09-2013, 10:47 AM.

                Comment


                • #9
                  I really appreciate both of you for contributing to my query !!!

                  "gmouse" you are always too precise, But sadly that leaves a lot of room for doubts and queries, ( No Offence ) i know you have a lot of other post to attend too !!!!

                  Scott, Once again thank you for being so elaborate in your response and educating me and other too via this post.

                  With reference to your first pointer, I have run the query "SHOW GLOBAL STATUS LIKE 'Com%';" once again on the server and the results are once again attached along with this post, I would like one last view from you in it and enlighten me with your comments and suggestions ...
                  Attachment

                  Comment


                  • #10
                    Looks like you either restarted your server or ran "FLUSH STATUS", as the variables have reset. But this still shows what has happened since then, and it is still showing about 94% SELECTS.

                    Statement Type Count Percent
                    Com_delete 13757 1.60%
                    Com_insert 17097 1.99%
                    Com_select 805702 93.68%
                    Com_update 23373 2.72%
                    Com_update_multi 139 0.02%
                    860068 100.00%

                    So as mentioned earlier, I'd start by processing the slow query log with pt-query-digest and addressing some of the worst queries to see if that helps with the load issue. Keep in mind that queries with a short duration that are ran a lot can be just as bad (or worse) than a very long running query that is only ran a few times. pt-query-digest helps you with this by ranking your slow queries, so starting with that ranked list would be good. =)

                    Comment


                    • #11
                      Hello Scott,

                      Yes, indeed the server had been restarted by the client, and that is the reason for the reset of the figures.

                      With regards to the "slow query log" i have not enabled this in the my.cnf, Do you suggest i enable this for a day or two and then run "pt-query-digest" on the logs ?

                      ALSO, Can you please point me to an example of "pt-query-digest" as to how to run it on the logs ? Rather what is the syntax for doing the same ?
                      Highly appreciate your assistance into this matter !!


                      Comment


                      • #12
                        Ok, I found something here :-

                        [URL="http://www.percona.com/doc/percona-toolkit/2.2/pt-query-digest.html"/URL]


                        So do you suggest i run the command :-

                        pt-query-digest slow.log
                        Or any thing specific ?

                        Thank you
                        Last edited by systemali; 05-10-2013, 09:42 PM.

                        Comment


                        • #13
                          If you enable the slow query log and leave the long query time at the default of 10 seconds that should be adequate to start out. For a completely untuned system, 24 hours is probably enough to give you a lot of queries to look at. Just try to get it during a normal business time, i.e. don't do it during the least busy time as that won't be representative of a normal workload. Having the slow query log enabled does add some extra I/O to record the queries, so if you you think the system is I/O bound just watch it for a bit to make sure things do not get backed up with the slow query log enabled. But unless the system is really maxed out it should be fine.

                          As for processing the slow query log with pt-query-digest, the default settings are normally good for basic query analysis / optimization. That will give you a ranked list of queries to look at plus statistics about each, like total run time, total count, etc. Keep in mind that processing the slow query log can be I/O intensive as well, so I would not do it on the production server. And if the slow query log is fairly large, it may take a while for the tool to process as it does a lot of summarizing.

                          Comment


                          • #14
                            Thank you soo much Scott

                            I have enabled the slow query log on the server, But i have not changed the "long_query_time" it is still #'ed out, So that means every 10 seconds my queries will be logged !!!

                            The rest of the points have been noted down, I shall get back to you tomorrow with an update on the results, It is business time here now ...

                            Thank you soo very much once again


                            Comment


                            • #15
                              Scott,

                              Since the slow logs are being logged currently, Can you let me know what is it from the file that i need to pay attention to ? So that i can grep the same and attach it along with this post for your reference ?

                              Thank you for your understanding.

                              Comment

                              Working...
                              X