Need help with mysql optimization

by ram07
8 replies
Hi every one,

I am in deep trouble with my client site, Often the server gets crashed. We have a dedicated server so that we can restart the server. Then its working fine.

By the time the server crash gets worse. I have found few things from the error log. Here are those,

1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18


2) [client 219.133.223.184] PHP Warning: mysql_query(): Too many connections /httpdocs/inc_rating.php on line 91, 97, 100, 106

3) [Tue Nov 29 00:08:26 2011] [crit] [client 122.164.131.157] (13)Permission denied: /httpdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: /login.php

Site type : Oscommerce
DB size : 127 MiB
Control panel : Plesk

Please let me know if could find any solution on this. Awaiting for your replay.

Thank you.
#mysql #mysql_pconnect #optimization #plesk
  • Profile picture of the author MariusPrice
    Originally Posted by ram07 View Post

    Hi every one,

    I am in deep trouble with my client site, Often the server gets crashed. We have a dedicated server so that we can restart the server. Then its working fine.

    By the time the server crash gets worse. I have found few things from the error log. Here are those,

    1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
    Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18


    2) [client 219.133.223.184] PHP Warning: mysql_query(): Too many connections /httpdocs/inc_rating.php on line 91, 97, 100, 106

    3) [Tue Nov 29 00:08:26 2011] [crit] [client 122.164.131.157] (13)Permission denied: /httpdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: /login.php

    Site type : Oscommerce
    DB size : 127 MiB
    Control panel : Plesk

    Please let me know if could find any solution on this. Awaiting for your replay.

    Thank you.
    I never worked with Oscommerce but its seems that you have some writing permission problems on your server.

    You had the site on this dedicated server from beginning?

    Maybe i can help since i work with my own server.
    Give me more details about what Linux system you running on server, do you have SSH access and whats the company from where you bought dedicated server and witch plan so i can take a look.
    {{ DiscussionBoard.errors[5140323].message }}
  • Profile picture of the author scriptkid
    1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
    Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18
    Your sites traffic is too high.. may be you have to increase the no. of simultaneously sql connection limit..
    {{ DiscussionBoard.errors[5140390].message }}
  • Profile picture of the author ram07
    Hi Marius,

    Thanks for your quick replay. here are the details of my server.

    Host : Frontline
    Plan : VPS Pro Linux
    Operating system : Linux 2.6.9-023stab051.3-enterprise
    CPU : GenuineIntel, Intel(R) Xeon(R)CPU E5345 @ 2.33GHz
    Average load : 0.12; 0.10; 0.09


    Hey, I have forgot to say about the CUP usage, when we login to our admin side (2-5) members the CPU usage reaches 170%.

    We have used few joint queries in orders page and listed 100 results in one page (pagination).

    And also, we have used curl to get the country details and country flag using the ip address from a third party website.

    These are all the information that i know about the server, SSH - i am not familiar with the server side.

    Please consider these information and give you suggestion how to stop the server crash.

    Thank you.
    {{ DiscussionBoard.errors[5140425].message }}
    • Profile picture of the author MariusPrice
      Originally Posted by ram07 View Post

      Hi Marius,

      Thanks for your quick replay. here are the details of my server.

      Host : Frontline
      Plan : VPS Pro Linux
      Operating system : Linux 2.6.9-023stab051.3-enterprise
      CPU : GenuineIntel, Intel(R) Xeon(R)CPU E5345 @ 2.33GHz
      Average load : 0.12; 0.10; 0.09


      Hey, I have forgot to say about the CUP usage, when we login to our admin side (2-5) members the CPU usage reaches 170%.

      We have used few joint queries in orders page and listed 100 results in one page (pagination).

      And also, we have used curl to get the country details and country flag using the ip address from a third party website.

      These are all the information that i know about the server, SSH - i am not familiar with the server side.

      Please consider these information and give you suggestion how to stop the server crash.

      Thank you.
      If this is the company from where you get the server frontline .net/dedicated_linux_vsp.php then you dont seems to have Root Access.

      You forget to answer to one question, this site was hosted from beginning on this Server and was working fine or you had shared hosting and then move the site on frontline ?

      Also the CPU usage reaches 170% huh i never saw something like this and maybe somethings wrong there on server.

      Did you tried to contact the support from frontline to see what its going on?
      {{ DiscussionBoard.errors[5140462].message }}
  • Profile picture of the author mojojuju
    Well one possible problem is that you're running Plesk on a VPS plan that has 256 MB RAM. The Parallels web site says that 512 MB ram is the minimum you should have to run Plesk. And you're also trying to run Apache+MySQL on top of that.

    BTW, for $45/month, you're getting screwed if they're only giving you 256 MB RAM, unless they've got a primo network or something. You'd do better if you went just about anywhere else. Hostgator, which I haven't tried but everyone here raves about, will give you 768 MB of memory for less than $45/mo.
    Signature

    :)

    {{ DiscussionBoard.errors[5141988].message }}
  • Profile picture of the author ussher
    why are you using mysql_pconnect() ? try mysql_connect() and see if that makes a difference.

    Then setup a dev server with xdebug and get some stack traces.

    Run your stack traces through kcachegrind and you will see all sorts of interesting things.

    Sometimes small tweaks or oversights can result in huge runtime improvements. eg, i once found i had accidentally put a query inside a loop that didnt need to be inside the loop, moving it outside the loop resulted in a massive performance gain. kcachegrind will show you this kind of stuff.
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[5145938].message }}
  • Profile picture of the author MariusPrice
    Originally Posted by ram07 View Post

    Hi every one,

    I am in deep trouble with my client site, Often the server gets crashed. We have a dedicated server so that we can restart the server. Then its working fine.

    By the time the server crash gets worse. I have found few things from the error log. Here are those,

    1) [client 128.61.28.185] PHP Warning: mysql_pconnect():
    Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /httpdocs/includes/functions/database.php on line 18


    2) [client 219.133.223.184] PHP Warning: mysql_query(): Too many connections /httpdocs/inc_rating.php on line 91, 97, 100, 106

    3) [Tue Nov 29 00:08:26 2011] [crit] [client 122.164.131.157] (13)Permission denied: /httpdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: /login.php

    Site type : Oscommerce
    DB size : 127 MiB
    Control panel : Plesk

    Please let me know if could find any solution on this. Awaiting for your replay.

    Thank you.
    I will try to help you, sent me a pm how i can be in touch with you, give me your skype if you have or Gtalk
    {{ DiscussionBoard.errors[5157590].message }}

Trending Topics