-
Notifications
You must be signed in to change notification settings - Fork 977
Speed up your page
I will try to explain here the magic we use to try to make our pages load faster and handle thousands of requests.
Enabling these options will certainly make your site load faster, but the content presented may not be the most recent.
for example, you just upload a video, and you can already see the video in the video manager, but it still does not appear on the main page. Do not worry, YouPHPTube is on the back updating it and will display for you soon, we will prioritize the quick presentation, even if this is not the latest content.
Websites are generally viewed hundreds, thousands, or sometimes even millions of times per month. Normally, each time a browser requests a web page, the server has to do a bunch of complex (and time-consuming) calculations. But if you enable this plugin instead process every request you will serve static pages that expire in a specific amount of time, and then this page will be recreated.
The audit plugin is useful when you want to track all database changes from your site (track users). but if you really do not need it feel free to disable it.
The purpose of this is to minimize the distance between your visitors and your video files, a CDN stores a cached version of your content in multiple geographic locations.
To use a CDN please read this
https://github.com/WWBN/AVideo/wiki/CDN-Plugin
Certainly! Here's the revised text, incorporating the additional information you provided:
To further enhance your site's performance and responsiveness, consider reducing the total number of videos displayed on the first page. By streamlining the content, users can experience quicker load times and a more efficient browsing experience.
Instead of showing 12 videos in sections like categories, trending, and latest added, you can display just 6 videos per section. This can make a significant difference in page load times. To adjust the number of videos displayed, you can configure this setting directly in the respective first-page plugin parameters (either Gallery or YouPHPFlix2).
In the Gallery plugin, you might want to adjust the number of video columns. Make sure the total number of columns you choose is a number that can be divided by 12, given that the layout is based on the Bootstrap grid system.
Another useful strategy is to not display all sections on the first page. If you have multiple sections like "Trending", "Most Watched", "Latest Added", and so on, consider displaying only the most crucial ones. This reduces the amount of content to load and makes the page feel less cluttered. Decide on which sections are essential and turn off the rest from the main page. To set up which sections to display or hide, head over to the settings of the respective first-page plugin (Gallery or YouPHPFlix2).
The Apache2Buddy script, similar to MySQLTuner, reviews your Apache setup and makes suggestions based on your Apache process memory and overall RAM. Although it is a fairly basic program, that focuses on the MaxClients directive, Apache2Buddy is useful. You can run the script with the following command:
curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | sudo perl
and edit this file to follow the apache2buddy recommendations
nano /etc/apache2/mods-enabled/mpm_prefork.conf
Here is a sample configuration the apache2buddy will let you know the MaxRequestWorkers value
<IfModule mpm_prefork_module>
ServerLimit 5000
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 1500
MaxConnectionsPerChild 0
</IfModule>
The MySQLTuner is a script written in Perl and allows you to quickly test your MySQL configuration and it gives you suggestions for adjustments to increase performance and stability.
According to the official GitHub page, it supports 300 indicators for MySQL/MariaDB/Percona Server in this last version.
To run the script you could do the following:
SSH to your server and run
curl -sL http://mysqltuner.pl/ | sudo perl
The script would run multiple checks against your MySQL instance
change the Variables to adjust, usually, you can add/change the variables on this file
nano /etc/mysql/mysql.conf.d/mysqld.cnf
sudo /etc/init.d/mysql restart
# General
skip-name-resolve = ON
max_connections = 100
# InnoDB Specific
innodb_buffer_pool_size = 5G
innodb_buffer_pool_instances = 5
innodb_log_file_size = 1G
innodb_log_files_in_group = 2
# Caches and limits
binlog_cache_size = 4M
thread_cache_size = 10
key_buffer_size=0
join_buffer_size=256K
expire_logs_days = 2
# General
skip-name-resolve = ON
max_connections = 150
# InnoDB Specific
innodb_buffer_pool_size = 10G
innodb_buffer_pool_instances = 10
innodb_log_file_size = 2G
innodb_log_files_in_group = 2
# Caches and limits
binlog_cache_size = 8M
thread_cache_size = 20
key_buffer_size=0
join_buffer_size=512K
expire_logs_days = 2
# General
skip-name-resolve = ON
max_connections = 250
# InnoDB Specific
innodb_buffer_pool_size = 24G
innodb_buffer_pool_instances = 24
innodb_log_file_size = 3G
innodb_log_files_in_group = 2
# Caches and limits
binlog_cache_size = 12M
thread_cache_size = 30
key_buffer_size=0
join_buffer_size=768K
expire_logs_days = 2
# General
skip-name-resolve = ON
max_connections = 350
# InnoDB Specific
innodb_buffer_pool_size = 48G
innodb_buffer_pool_instances = 48
innodb_log_file_size = 6G
innodb_log_files_in_group = 2
# Caches and limits
binlog_cache_size = 14M
thread_cache_size = 40
key_buffer_size=0
join_buffer_size=1M
expire_logs_days = 2
# General
skip-name-resolve = ON
max_connections = 500
# InnoDB Specific
innodb_buffer_pool_size = 96G
innodb_buffer_pool_instances = 96
innodb_log_file_size = 12G
innodb_log_files_in_group = 2
# Caches and limits
binlog_cache_size = 16M
thread_cache_size = 60
key_buffer_size=0
join_buffer_size=2M
expire_logs_days = 2
If you will have over 1k users at the same time you may need to follow this http://socketo.me/docs/deploy#ulimit
Those are the commands that work for me
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
sudo apt-get install libevent-dev php-pear php-dev make pkg-config
Edit php.ini nano /etc/php/7.4/apache2/php.ini
and add extension=event.so