Link to home
Start Free TrialLog in
Avatar of danswill
danswill

asked on

Using CDN on a company website

Hello Experts Exchange!

To start, here's a little background on the issue: We have a company website that is currently hosted on InMotion Hosting and was written in php. This website is used to generate pdf documents that vary in size from 250KB to over 2MB.

Recently, we've expanded to include more staff members and more pdf documents are being generated on this company website. The issue that I'm running into is the load on the server.

I'd like to reduce the load on our server and I've read that a CDN is a good solution to this problem. Is a CDN the right solution? If it is, can someone walk me through what it takes to get a CDN on our website? I'm looking for a high-level approach such as 1) here's why you should use a CDN 2) go sign up for a CDN such as Amazon CloudFront 3) here's a high level approach on how to use it.

If I'm not phrasing my question right, please let me know and I'll try to clarify.
Avatar of danswill
danswill

ASKER

As a follow up questions, let's say I have a php script at www.mysite.com/generatepdf.php and this file will output a pdf document so the user can download it. Can I put just this file on a CDN?
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Padas!

Thank you for the quick comment!

If I have the pdf generator at www.mysite.com/generatepdf.php, could I host just that file on the CDN and keep everything else at the original server?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello GaryC123,

The pdf generation process is what I think causes the most load on my web server. Is there a way to store a php script off-site so my web server doesn't take the load? I'm not sure if I'm phrasing my question right.
You could use one of Amazon's hosting solutions, but this is not a CDN anymore, and may not be a good solution
You are on a VPS?  You may need to just tweak your server. What memory do you have etc.
If it is the creation of the pdf file that is hogging up resources, then a CDN is not going to solve your issue directly.  However, you could process your pdf creation on Amazon as an ajax call or direct post.  From there you can either keep the pdf's stored on amazon or copy to your server.  Since space is so in expensive, probably just as easy to keep them there.

You don't have to use Amazon, since you are doing this via php, you could just use a cheap shared hosting service.  I would point a subdomain to which ever solution you go with.
padas has a good point.
I have a vps for £10 a month that has a better spec than the cheapest option at the place you are using (only difference is no cPanel)
Hello!

Here's the specs on the hosting plan.

RAM:   1GB / 2GB Burstable
Storage:    80GB
Bandwidth:    1,500GB/mo.
IP Addresses:    5
Environment:    CentOS, cPanel, WHM

Just so I'm clear, the consensus is that a CDN will not solve the server load issue. Is that right? If a CDN does not help, would an upgrade to my VPS help out?
What software are you using to generate the pdf's, what memory do you have allocated to php? Whats the CPU?
And yes a CDN would be of no help (hmm a positive negative)
I'm using tcpdf to generate pdf documents and my memory limit is set 64M.

Thank you for answering my questions. This really helped clear some things up for me.
Try increasing the memory to 256, you have 1gb so plenty to play with and gives php more room to prevent disk thrashing.
I will look at tcpdf and see if there is anything in their docs
Have a look thru this, and see if you can implement any of the tweaks
http://www.tcpdf.org/performances.php
Fixed?
Hello Gary,

I did read through the optimizations and I put some of them in place. Only time will tell if these fixes will work, but I think they will! Thank you!