News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Can a poorly written script bring down even the strongest server?

Started by Biology Forums, June 22, 2015, 12:40:39 AM

Previous topic - Next topic

Biology Forums

I just purchased a high-powered dedicated server for the purpose of combatting the growing number of visitors. After the whole thing was done, I found that the same script which caused my previous server to choke was still creating problems.

I'm curious, with all the scripts Google, Facebook, Twitter, etc. runs on their website, is it that their servers simply have an endless supply of memory/ram or is it that they are well written, which prevents the servers from choking? And, can a poorly written script bring down even the strongest server?

☠ DeadMan ☠

QuoteCan a poorly written script bring down even the strongest server?

Yes, it can.
We had seen one, ironically, a mod for SMF, that got a friend's Premium hosting account to have a few pauses, due to using up way too many Entry Processes. After removing the mod, the site does not seem to even use much of any resources.


margarett

It can, yes. But it also depends on a myriad of things...

If the script fetches some external data (eg, via JavaScript, cURL, etc) it depends on the source so it won't "choke" the server but it will choke the page load.

On the server itself, it depends on what the script is doing and how. If it's just code (eg, massive while or for loops) it will use all the CPU available to the process no matter how powerful the machine is (it will just finish faster on one machines than others). If it has heavy database interaction, most likely it requires a rewrite, cache, etc.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

青山 素子

To answer the general question, yes. It's not difficult to find a way to break even a very powerful server.

Quote from: Shuban on June 22, 2015, 12:40:39 AM
I'm curious, with all the scripts Google, Facebook, Twitter, etc. runs on their website, is it that their servers simply have an endless supply of memory/ram or is it that they are well written, which prevents the servers from choking? And, can a poorly written script bring down even the strongest server?

The companies have teams dedicated to tuning their servers. Some servers are set up to handle database loads, others web applications, still others storage. When you get as big as these places, you need to focus on getting the maximum of resources for each task you're doing, so making servers specialize in one type of task is a quick way to help. Beyond that, much of the software they run is written by them and very carefully coded and configured to use the least bit of resources needed to do its task. It's all very complex and very specialized, and rarely needed outside that kind of massive traffic. Most of the big gains can be done easily with simple tasks that most websites needing more than one server can implement.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


KnownSyntax

Like everyone else has stated, yes it's extremely easy. All you would have to do is overload that script (keep on having it called) and depending on it's performance impact it could either crash the server, lock it up, or it would lead to very slow slow page loading times.

Biology Forums

Definitely, I made it a goal of mine to remove all suspicious php scripts.

6TiME6

A poorly written script can definitely bring down the most powerful server. Very often people think if their site is slow the logical next step is to upgrade the hardware resources, but more often than not this is not the right approach.

Especially poorly written plugins can slow down everything, so first step if there are unusual performance issues is to disable them one by one to see which one might be the root of all evil.

It can also help to optimize the hosting environment, such as use of file cache, operation code cache (Zend Opcache for example) and object cache. However when there is really poorly written code involved, even the best hardware and hosting setup won't stand a chance and your best bet will be to hire a skilled coder who can find and fix the bottlenecks and optimize the code for best performance - you can check out hxxp:freelancer.com [nonactive] to find affordable coders.

Advertisement: