Community & Support

VPS or shared hosting: is PHP memory limit all-important?

I have a simple question which I know will not have any simple answers, but here goes: Should I using a Virtual Private Server (VPS) for my Drupal sites, or is shared hosting sufficient? I am currently comparing Go Daddy's shared hosting with eApps' Virtual Private Server (VPS), and I am wondering what is the real benefit of a VPS?

I thought a VPS would give me far better performance than a shared hosting service, but I since discovered that I am able to set a far higher PHP memory limit in the Go Daddy shared hosting account (≥ 256 Mb) than is possible with the cheaper VPS service (~ 96 Mb). If memory was the most important factor, I would conclude that the shared hosting is the best solution, however I would like to hear the advice from the Drupal community before I make up my mind.

Comments

.

Did you check that you can actually use the 256M? The fact that you can set your memory limit to 256M does not mean that the memory is available to you.

Try this, and see at which point it crashes with an "out of memory" error. You may find that it crashes long before your 256M limit.

<?php
ini_set
('display_errors', 'On');
$new_mem_limit = '256M';
$old_mem_limit = ini_set('memory_limit', $new_mem_limit);
print
'Memory limit changed from '. $old_mem_limit .' to '. $new_mem_limit .'<br />';

$step = 1;
while(
TRUE) {
 
$chunk = str_repeat('0123456789', 1024*1024*$step++);
  print
'Memory usage: '. round(memory_get_usage()/(1024*1024)) . 'M<br />';
  unset(
$chunk);
}
?>

Thank you very much for your

Thank you very much for your memory test. I had suspected that the limit was lower than the value I was asking for and now I know what it actually is. The "out of memory error" occurred after the 170M step. Still, that is far better than I can get with the VPS. The question therefore remains: are there any good reasons to choose the VPS over the shared hosting?

It's likely that the real

It's likely that the real limit on shared hosting will change drastically depending on what other sites on the shared host are doing at that time. There's probably no guarantee on what the lower limit will be.

Does the VPS guarantee you X amount of memory, with possibly more actually available depending on load?

Memory guarantee

As far as I am aware, the memory allocation with the VPS is guaranteed and fixed (i.e. no more available for high load situations).

I might monitor the shared hosting account and see if the limit fluctuates at all, or I'll just ask the company directly.

Is memory limit one of the most important criteria I should be considering when deciding which service appears the best (setting aside things like uptime and cost)?

Try Host Gator

The memory you need is also highly dependent on the modules you end up installing.

If you're not a server admin, you also need to carefully consider what type of support your hosting provider will give you on your VPS. Is it a managed account (meaning they are your support team)? Or, are you on your own?

Either way, I would highly recommend Host Gator. Their tech support is second to none.

We operated on a shared account with 40+ sites for over a year and never had any performance issues. The only reason we moved to a VPS was to get more control of what we could install on the server.

re. managed account

The VPS from eApps is managed and they offer 24/7 support. I've also heard other good things about Hostgator and will consider them too. Thanks for the suggestion.

I've worked with a variety of

I've worked with a variety of VPS plans, and they are generally capable of much higher performance than shared hosting. Make sure you have a fixed, guaranteed amount of memory. I have a few clients on Parallels and OpenVZ type virtualization, and it's "boost" memory many hosts tout is completely worthless. Yes, it's memory, but as soon as you use it, you risk the offending process being killed with no graceful recovery mechanism. I strongly recommend going with a Xen-based host.

Sweet! Thanks cog.rusty for

Sweet! Thanks cog.rusty for providing this!

Not thread-jacking but just wanted to give history on how I stumbled on this thread. I'm w/ Media Temple (gs) (their shared hosting on the "grid") and my memory limit is capped at 41mb (which sucks big time). I can't even install the Devel module =( I'm working w/ their support team to hopefully improve this.

I needed another way to verify my memory cap (other than Fatal error: Out of Memory) and this snippet helped me.

Also used this on my shared hosting in HostGator, and saw it was capped at 64mb. Pretty sad when you consider that HostGator's customer support is more helpful and responsive than Media Temple's. W/ HostGator, they have chat support and you can try to get it done there (immediately) and if they can't do it, they escalate the issue and open up a ticket for you. For Media Temple, they have a ticketing system only, and their response time varies greatly (from 15mins to 24 hours).

mt

You can change the memory settings at Media Temple with grid server.

http://kb.mediatemple.net/questions/137/How+can+I+edit+php.ini+file%3F#gs

I set mine to 220M but using the program above it maxed at 170M

David Sanger
www.davidsanger.com

Apples and Oranges

You're comparing 2 different things. The PHP memory limit is how much ram a SINGLE PHP process can use. There's no point in increasing this beyond the amount of memory your particular site requires.

There's a big difference between that and the TOTAL amount of RAM your site can use. Which would be the likely advantage of using a VPS, that this will let you use more total RAM and more CPU than a shared hosting plan.

This really all depends on how much load your site generates, and how busy it is. There's no simple answer as to whether a VPS will work better for you than shared hosting, other than to say that if your site is busy you PROBABLY want a VPS.

Steve Hanson
Principal Consultant Cruiskeen Consulting LLC
http://www.cruiskeenconsulting.com

If you enable quite a lot of

If you enable quite a lot of module or include image cache module, usually you will need a VPS hosting solution which will guarantee the memory(more money for sure).

Godaddy is not a good hosting for Drupal hosting, Hostgator could be a good choice.

On shared accounts, there

On shared accounts, there will usually be a hard limit regardless of whether PHP accepts you memory increase command. I found that Hostgator’s shared accounts are capped at 64MB, which is more than enough to run your average Drupal site.

You’ll need more memory if you are using Imagecache to generate thumbnails of large images. If you let your users upload very large images (often users upload pictures taken with their multiple-megapixel cameras), you’ll need over 100MB of RAM available to Drupal. I found that the 64MB limit is exceeded at something like 2-3 megapixels.

On mission-critical sites that must be up without a glitch even during continued development, you’d want to have the availability of a high memory limit in case bugs in the code result in memory leaks. For instance, I once deployed a site using a contributed module for customizing forms. Everything was fine until we installed an updated version of the contributed module, which had a memory leak problem building garbage into Drupal’s variables and resulting in a constant growth of 1 MB of memory usage to load a page. It started at around 22 MB and would continue increasing on every page load until constantly crashing at the 96MB limit set for PHP.

Debugging such a problem may take 1 hour, or may take several days. Even if you made all updates in a development server before moving to production, you may not notice the memory leak until real traffic starts hitting the site. At that point, being able to raise the memory limit might be the one thing that keeps the site live while tracking the issue.

Regards,

C.E.O of Avenue Web Media, a Chicago company that specializes in web development, online marketing, and professional custom Drupal themes.

Thanks

Just wanted to say these responses have been super helpful to me in deciding where to host. Thanks a lot!

http://www.maLineage.com - Preserving the legends of martial arts, past and present.

HostGator php limit 64mb UberCart

Honestly, this is a great and informative thread.

@chien_fu - who did you end up using for hosting?

I am about to host a website that may be considered "bulky" it combines social-community features (forums etc.) with e-commerce capabilities (UberCart Marketplace). It uses quite a few (about 80) modules though I will "clean house" before hand and remove unneeded modules. The main players are Views, Panels, Imagecache, and UberCart.

UberCart, Imagecache and Views I think will be the killers.

I am looking into shared hosting with HostGator, specifically their business plan with dedicated IP and shared SSL (doing e-commerce after all) which is going for about $12/month with a whole punch of "unlimited" stuff. Launch will largely be used for beta testing - low traffic expected for the foreseeable future.

HostGator caps their PHP limit at 64MB and I think block access to php.ini so no easy tweaking really.

I just turned on the Devel query time and memory logging tool and found that when I had caching turned off and with the theme registry being rebuilt I was seeing about <70mb per page load. So I am assuming once I turn on caching on the production site and turn off theme registry rebuilding, memory should hover around 50mb?

Is this a safe assumption?

Feedback greatly appreciated.

Linode

@Stomper
I am using www.Linode.com
Seems like a pretty good service for virtual private servers. I got a 500mb Ubuntu machine for $19/mo. I have two drupal installs running currently and using about 250mb total. It's really easy to expand the bandwidth and capabilities if necessary too. (I'm planning optimistically for high traffic:)
Of course you don't get some of the benefits of shared hosting, but you get more freedom to do what you please.
A question for Hostgator would be, do they allow short bursts of memory usage above and beyond the 64m? If so, I think you're probably good, but if it's a hard limit I would be concerned. I know that it's a hard limit with 1&1, but many shared providers allow you to go over on occasion. My Linode VPS allows 1000mb bursts with my 500mb machine.

http://www.maLineage.com - Preserving the legends of martial arts, past and present.

Hostgator memory burst

How's your Linode experience been so far? I may look into Linode or a VPS elsewhere. I am looking for UberCart support so an SSL and dedicated IP should be available. Does Linode offer services like that? How hard is it to install/setup Drupal - I have a preexisting site on my localhost?

Also, I would like to run Apache Solr search, can you do that with a VPS? Linode VPS?

I spoke with HostGator via live chat. In terms of their 64mb memory limit for shared hosting plans (specifically Business Plan with dedicated IP and shared SSL ~ $12/mo), the technician said it was a ceiling implying no burst allowances.

Also, when discussing how Drupal is quite resource intensive during module queries/updates/enabling/disabling he said that if I did exceed the memory limit during such process, errors would be displayed to site visitors along the lines of a "500 Internal Server Error" though the Drupal UI/Admin will still be usable. Memory recovery should take a minute or two and then the error messages should disappear. These statements maybe a little "noobie" but this is my very first time dealing with hosting beyond a localhost (XAMPP on Windows XP).

In the event my website experiences above normal traffic that exceeds memory, Hostgator's policy is to boot off your website until you (site admin) contact them - no warnings.

I may look into Hostgator VPS though Linode seems like it has great pricing. HostGator mentions something about Plesk and CPanel. What is Plesk? Do you have experience with it?

Plesk -

Plesk - http://www.parallels.com/products/plesk/

It's a management tool (front end ui) for hosted sites, similar to cpanel. It's a matter of preference, but many people like plesk.

If you are looking into a VPS, be aware that most offer unmanaged hosting, meaning no technical support. You'd have to ssh in to your server and many sys-admin stuff on your own. Linode however, has great documentation and tutorials to get your server up and secure (from my research, I don't personally get my hosting from them). If you're looking into managed solutions, they're a lot more (like $200/month).

I highly recommend HostGator as I've been w/ them for a while. Their customer service (especially chat) is very helpful and responsive.

I'm dabbling with moving my

I'm dabbling with moving my GoDaddy shared to VPS right now.

I'm trying the basic VPS plan for 30 bucks - 1GB Ram.

I moved everything over and got the dreaded White Page Of Death.

Increased the php memory limit via htaccess and that got the site working right away.

However, anytime I try to login I get the White Page of Death.

Not sure if I'm exceeding the memory limit or what. I do use a lot of modules, though.

What a pain it is setting a VPS up! Had to find a way to import large databases, move over 70,000 files, figure out how to use ssh, upgrade version of php etc etc! I need a beer now, lol.

BTW, Is there anyway to determine how much memory your site should have?

For while page of death, you

For while page of death, you can refer to below page by printing out the error so that you will know what's the root cause.

http://drupal.org/node/158043

Advertising helps build a successful ecosystem around Drupal.