Site icon Sprintally®

Why website goes down?

Website

No, the website does not fall because he was tired. There are other, more obvious reasons for that, and now we have considered the three most likely of them. We assume that the site is “spinning” on a virtual server and if on a physical server, then everything is fine with hardware and there are no hardware faults.

Over the disk space/free inodes

The most obvious reason for the fall of the site. During the operation of network services like Apache, MySQL generate decent amounts of data – logs, temporary files, not to mention the user-uploaded data.

The service simply has nowhere to write further data and it “crashes”. Also, the reason for the fall of the same Apache can be an extremely large log size.

We recommend the following:

Check disk space

Where is the disk space?

DELETE FROM wp_commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM wp_comments)

And now attention! Sometimes it is not the free space that ends, but the free number of inodes (i-node). The result is the same – the system cannot create the file and the site “crashes” due to the suspension of the network service. Where are the inodes? Some engines, such as Magento, generate too many session files (usually stored in / var/session, but it all depends on the engine settings). Such files are very small, they practically do not take up space, but they steal precious inodes. One of the tactics is to regularly clean the directory of sessions. The following script is added to cron:

cd /var/session
for i in sess_*; do rm -fv $i; done

The disadvantage of this method is as follows:

An alternative and more correct solution are to create another drive (or partition) with the file system ReiserFS. She does not Shine in performance but allows in a single block to store multiple files — while the block size is not filled. ReiserFS completely solved the problem with the inodes. The server is now quietly holding millions of files inode and cleaned /var/session is quite rare – on the server automatically cleans off and is done manually by the administrator once a month during regular server maintenance.

The lack of other resources for the website

In addition to disk space, do not forget about the memory and processor resources. The htop command will help here, which shows not only running processes but also consumed resources.

htop
The command htop

One of the reasons for the decline of the website – lack of resources, especially if we are talking about monstrous engines like Magento. They are sensitive not only to RAM but also to the number of cores.

Exit mobile version