Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Is it Perl problem or VPS problem?

by Gary Yang (Acolyte)
on Apr 06, 2012 at 07:49 UTC ( #963784=perlquestion: print w/replies, xml ) Need Help??

Gary Yang has asked for the wisdom of the Perl Monks concerning the following question:

I host my Perl application at a Virtual Private Server (VPS) with a Web Hosting company. The RAM is 512 MB, CPU is 1024 MHz. I use Apache server. Here is how my application works:
Users visit my web and click search icon, it triggers the Perl application. The Perl scripts process the data, print results as HTML page and display to the user. This Perl script use threads.
Here is the problem. I opened four different browsers; IE, Chrome, Safari and Firefox. I clicked on the search icon at same time on these four browsers (It simulates multiple people using the web application at same time). It triggers the Perl application. The problems are; there are always one or two browsers dead, meaning that it always one or two processes of Perl scripts dead. No return results printed as HTML page. I checked the Apache error_log. There is no single error, i.e. the Perl script dead without error message. I use “ps –ef” to look for the process. The processes were dead.
I redo this test at a physical Linux box. I tested it many times, the Perl process never dead. The four browsers always returned the results in HTML pages. I complain that there is a problem with VPS. But, the Web Hosting Company says that it is the problem of my Perl scripts. The processes were dead. There is no error in error_log. I do not know how to debug my Perl application.
Anyone has similar experience? How to solve this problem?
Will increase the RAM and CPU of VPS solve this problem?
Or it is the problem of VPS, the Web Hosting Company should solve this problem? Or there are bugs in my Perl scripts, I should fix it?
Since it works on a physical Linux box, should I to go with Dedicated Server? Is the dedicated server a physical box? The dedicated server is very expensive in general. I prefer not to choose this solution unless I have no other options. Anyone, please help.

Replies are listed 'Best First'.
Re: Is it Perl problem or VPS problem?
by marto (Cardinal) on Apr 06, 2012 at 08:06 UTC

    "Or it is the problem of VPS, the Web Hosting Company should solve this problem? Or there are bugs in my Perl scripts, I should fix it?"

    You mean is the problem with your Perl code which you haven't shown? How are we supposed to know? You haven't even properly described how your code works.

    "I do not know how to debug my Perl application. Anyone has similar experience? How to solve this problem?"

    "Since it works on a physical Linux box, should I to go with Dedicated Server? Is the dedicated server a physical box? The dedicated server is very expensive in general. I prefer not to choose this solution unless I have no other options."

    To solve the problem you need to learn how to debug your Perl code. I suggest starting with Ovid's CGI Course, Web Programming from the tutorials section, basic debugging by logging what your script is doing so you can find out where problems are. You should learn how to debug and benchmark your code, regardless what type of platform it is going to run on. If there are differences between the system you developed (and presentably tested it on) and the system which it runs on, you need to be aware of what impact this will have on your code. You need to be able to prove that the problem isn't with your code before you complain to your VPS host. A dedicated server is a physical server.

    Update: s/presentably/presumably/ auto correct fail.

Re: Is it Perl problem or VPS problem?
by cursion (Pilgrim) on Apr 06, 2012 at 14:14 UTC

    The box you are testing on doesn't have the same restrictions as the box where you are having problems. This is one of your problems.

    Some ideas ... Write a separate Perl program that uses a bunch of memory, like a large array ... does that disappear when you run it? Increase the array size. What about running several copies? Log information (eg "made it here") to a separate file or use warn (and check error log). Does that die right before the array is loaded?

    Ask the VPS people what kind of warning you get if your programs exceed the memory limit. I bet you get no warning and nothing is logged anywhere. Maybe decrease the number of threads? Each thread only increases the memory.

Re: Is it Perl problem or VPS problem?
by mbethke (Hermit) on Apr 06, 2012 at 20:35 UTC
    ++ to Marto, and one more idea: are you perhaps using the mpm_worker Apache module? That one is said to cause problems with threaded code because it does its own threading and the two implementations don't coexist too peacefully. Completely dead processes point to more serious problems than either Perl or Apache usually cause on their own, so this could be one.
      All, Thank you very much for your comments, suggestions and ideas. I upgraded the VPS RAM to 1GB. Problem solved. So, it looks like threads died when lack of memory.

        Since you didn't post any code we've know way of knowing if there could be any changes made to fix the "problem" rather than simply throwing more resources at it.

Re: Is it Perl problem or VPS problem?
by Anonymous Monk on Apr 06, 2012 at 07:56 UTC

    I use Apache server.

    Which means mod_cgi or mod_perl or mod_perlite or what?

    How to solve this problem?

    Step 1, diagram the setup fully

    Step 2, review setup

    Step 3, code review

    Hiring a consultant might be faster

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://963784]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-03-05 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (109 votes). Check out past polls.

    Notices?