Question

My website is slow

Posted January 22, 2019 3.7k views
ApacheDebian 9

Hello, how are you?

I have a site that is hosted on a droplet, however it gets very slow in a few moments.

The memory does not exceed 50% of consumption. The CPU is only 33%.

As far as processes are concerned, apache2 always consumes more than 100% of memory.

What can I do?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
6 answers

Hey friend,

This could be caused by a number of different things. My recommendation is that you start here to identify the point at which it becomes slow:

https://gtmetrix.com/

The result of your test will determine what to do. If the slow point is before anything starts to load, you may need to optimize your web server or web application. More often than anything else, the answer is to optimize your web application by reducing the amount of effort required by the server to generate a page to load.

An example of optimizing a web application is to use Wordpress, since it is most common. In such a case, reducing plugins and using a lightweight theme, as well as using a static caching plugin, can help with that.

If it isn’t at the beginning there, you should be able to see that it is specifically something else. If it’s an external call, it may be another server running slowly and you may need to pull the content locally. If it’s something like a large uncompressed image, then you can compress the image and re-upload it.

Jarland

Hi !

if it’s a wordpress website you could try wprocket, which works fine for me.

Hi,

If your website is slow then optimize your website image, remove cache history when your site developed in WordPress then you can install wpcache plugin .

I have a website on the same problem. WordPress website is very slow.

Business without IT is not real now. Web sites and mobile applications for business are particularly effective.

Hi @hnogjf,

I’m just posting the typical issues/resolutions to such cases. They are almost every time connected with two things - Website Optimization and Server/Droplet Optimization.

Let’s start with Server Optimization.

When looking at Server/Droplet Optimization, there are a few necessary services/packages that are universal.

  • The first one would be Server-side caching. Server cache is an umbrella term covering a number of different types of caching. This includes Content Delivery Network (CDN) caching, object caching, and opcode caching. Depending on what you want to achieve you might need one or the other. Usually, though, you can have all 3 types of caching as it shouldn’t interfere with your Website/App. I won’t go into more details about what each caching does as this post will become 3 pages long. There are multiple documents providing services/packages for each of the server-type caching.

  • Next would be using PHP-FPM (if your Website is using PHP of course). PHP-FPM is an efficient method on how to minimize the memory consumption and rise the performance for the Websites with heavy traffic. It is significantly faster than traditional CGI-based methods in multi-user PHP environments.

  • Another solution would be Database Caching. A database cache supplements your primary database by removing unnecessary pressure on it, typically in the form of frequently accessed read data. The cache itself can live in a number of areas including your database, application or as a standalone layer. Usually, for this kind of caching is being used Redis.

  • Apache NPM modules. If you are using Apache, you are using one of three NPM modules. Most certainly if you haven’t configured anything on it and have used the default configuration, you are using NPMPrefrok which is the most outdated one and thus the slower. I’ll recommend using one of the other two - NPMWorker and NPM_Event depending on your situation. Again, I would urge you to read more about these 3 and what is applied in which case.

Those were the basic optimizations on a server level, let’s start with your Website/App

If you are using a CMS like WordPress, Magento, Joomla, Opencart or anything of the same matter, there will be plugins/addons. These addons can be very powerful if used correctly. The most helpful plugins are:

  • Caching Plugins
  • Image Optimization Plugins
  • Plugins that reduce redirections/requests
  • Plugins that reduce the size of JS and CSS files.

If you are not using a CMS, you’ll need to try and do what these plugins are doing manually.

Usually, Websites/Apps are slow because of a couple of reasons which range from too many requests or big images to a bunch of unnecessarily big JS or CSS files. Optimizing these whether you are using a Plugin or doing it manually is enough.

I hope this was helpful.

Regards,
KFSys