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.
danswillAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

danswillAuthor Commented:
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?
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
A CDN is a good idea because you upload your files to one spot and you only need to link to the files one way.  However, the CDN takes your file and sends it across their network.  When a  user requests the file, the CDN serves it from the nearest datacenter.  So if you are in California or the UK you get about the same access time.  This is especially good for media files.

Amazon http://aws.amazon.com/cloudfront/ is a good source as is http://www.rackspace.com/cloud/files/ which uses the http://www.akamai.com/ network.  You can also go direct.  

If you have a huge amount of traffic and large pdf's this does make sense.  I think even shared web hosting solutions can handle more traffic then you would think.  If your only getting  a few hundred downloads per month and the pdf's are not large or your traffic is mostly from one region, a CDN may not be necessary.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
danswillAuthor Commented:
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?
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

GaryCommented:
Cannot see any benefit to dynamically generating a pdf then uploading to a CDN so that the user can then download it
It's a waste of time and will result in a delay for the user to download it.
If you are referencing cached pdf's then padas' comment is correct.
A CDN is global storage system, it is not a server like Apache (well it is but you cannot use it like that)
0
danswillAuthor Commented:
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.
0
GaryCommented:
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.
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
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.
0
GaryCommented:
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)
0
danswillAuthor Commented:
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?
0
GaryCommented:
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)
0
danswillAuthor Commented:
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.
0
GaryCommented:
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
0
GaryCommented:
Have a look thru this, and see if you can implement any of the tweaks
http://www.tcpdf.org/performances.php
0
GaryCommented:
Fixed?
0
danswillAuthor Commented:
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!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.