Performance optimization

These tips are designed to help you not crash when increasing loads. With proper equipment and proper load distribution, your network can easily handle millions of unique visitors per day.

The correct server

We already implemented it in our server setup script. Configure your server as efficiently as possible. Here are some guidelines:

  • Use server monitoring tools, such as Zabbix, to identify moments of heavy load and weaknesses in your server fleet.
  • Use a dedicated server instead of a virtual one. So all the resources of a powerful machine will be under your control.
  • Switch from hard drives to SSD and NVMe drives. This will speed up the file system and increase database performance.
  • Do not use the control panel on the server. Any control panel takes over some of the resources and can become a security hole.
  • Discard any unnecessary components on the server. A separate FTP server and unnecessary services consume resources.
  • Configure MySQL server by allocating a large amount of cache memory. You can learn more about setting up MySQL in Google.
  • Switch to MariaDB instead of MySQL.
  • Update PHP to the latest version. Using PHP version below 7.2 is not recommended.
  • Use a lightweight nginx web server instead of Apache2.

MemCached Caching

The network works with built-in caching mechanisms for frequently requested data. Classic installation uses filesystem caching mechanisms or built in APCu. You can switch the caching to MemCached and reduce the load on the file system (in addition, and increase security). Make sure you have MemCached installed and the corresponding PHP module on the server.

In the control panel config.php file, add or uncomment the following lines:

define ( 'MC_HOST', '127.0.0.1' );
define ( 'MC_PORT', '11211' );
define ( 'MC_PREF', 'mycpa' );

Most often, these parameters are suitable without changes. When working with multiple networks on a single server, change MC_PREF.

Cloud caching

The load on servers with landing pages and pads can be significantly reduced by connecting them to the cloud cache. CloudFlare can be a free solution. Integration instructions can be found on their website.

It is recommended that you add the IP addresses of all your servers and counterparty servers to the white list in order to eliminate the loss of API requests.

Additionally, it is recommended to add a rule Page Rule for passing traffic with statistics of clicks, as it can be recognized as attempt of attack. To do this, go to Page Rules, click the Create page rule button and specify the address in the input field:

http://landing.ru/*/?good=*

Where landing.ru -the address of the connected domain. Use the Add setting button to add the following settings:

  • Browser integrity check: Off
  • Security level: Essentially off
  • Cache level: Bypass

The resources allocation across multiple servers

The platform was originally designed to support distributed load across multiple independent servers. The optimal load distribution is the use of two separate servers:

  • The control panel server that hosts the main platform, the redirection module, and the ClickServer
  • Site storage server

If you have problems with the load, the first recommendation is to transfer landing pages and applicants to a separate server.

Important! Servers need to communicate with each other, so to increase performance, they must all be located in the same data center!

Server for sites

You can use a separate server for sites, or a cluster of servers with file synchronization via rsync. Technical requirements for them do not change:

  • –ěS: pure Linux with no control panel and extra modules
  • Web server: nginx + PHP-FPM v7.2 and above
  • PHP-modules: json, curl, sockets
  • MySQL and ionCube - no requirement

When using multiple servers for sites, we recommended locate the site store itself on the main server. All the data must be transferred to the front servers via rsync. Park a separate hidden domain to the main site storage (for example, the r.domain.com subdomain of the main network domain), specify it in management URLs in the settings section. Use external solution to generate SSL certificates.

The primary server platform

If necessary or as an experiment, you can distribute the components of the main site to different servers:

  1. The MySQL database server can be moved to a separate machine with a large amount of RAM and NVMe drives as storage. Make sure that there is a very fast communication channel between the application servers and the database server.
  2. The ClickServer can also be placed on a separate machine. No third-party software is required on this machine at all. It is recommended to start the ClickServer manually in any convenient way.
  3. The MemCached cache server can be brought to a separate machine with fast network access. This allows you to use multiple servers for different parts of the app.
  4. When performing steps 1 and 3, the redirect domain can be transferred to a separate machine from nginx as a web server. At the same time, the platform files should also be installed on the server, possibly in a hidden folder (located outside the site directory). Core and data folders (without content) are required from the distribution.
  5. When you perform steps 1 and 3, you can move the API work to a separate machine. Setting the URL in this case is entirely up to your IT specialist.