The Origin Settings on the ArvanCloud CDN Panel
Indeed, the Origin and the central server that uses the ArvanCloud CDN services mean the same. In the following lines, we discuss the settings concerning the method via which the system transfers the requests from ArvanCloud to the central server (or the Origin).
Notice that if the response exists at the Cache of the CDN, the Origin will not receive the request (except for some instances such as Revalidation).
The Load Balancing Settings
Load Balancing is implemented based on the IPs which you have allocated for each domain in the Record Activation section. If you have specified at least two IPs for a domain, you can use the Load Balancing attribute on the ArvanCloud CDN. Nevertheless, in the case that you have allocated just one IP for a domain in a record, you cannot use the Load Balancing.
For this purpose, you ought to open the Record Activation section and edit one record:
The weight assigned to each server affects the Load Balancing. Hence, you have to consider the weight in the case of records that include several IPs. For example, the number of requests transferred to a server weighing 20 is twice as many as another weighing 10.
After assigning the weight, come back to the Origin Settings page, the Load Balancing Settings section.
Selecting the Load Balancing type: There are two options at your disposal here:
- Round-robin: This mode makes the user's requests distribute in turn. For example, the first request from the first user is transferred to the first server, the second request from the same user to the second server, and the same for other requests and users.
Based on User's IP: Sometimes, we need to transfer a user's requests to only a specific server and prevent their distribution among several servers. You can employ this option in such cases.
In such a case, transferring the user's request to the Origin server occurs based on the user's IP, and the requests that CDN receives from an IP is sent only to an Origin and does not distribute among various servers.
Provided that the CDN receives requests from distinct IPs, it will randomly distribute among the Origin servers. Therefore, the Load Balancing still works and distributes various users' requests (with different IPs) among servers.
- Number of Errors to Remove the Server from the List: When an origin server breaks down, you must remove it from the Load Balancing list and transfer no request to it. Hence, you must restrict the number of allowed errors. For example, when you select the digit 2 for the error number to remove a server from the list, you have settled that it should remove the origin if the origin does not respond twice or responds with the error 50X.
- TTL: When an origin drops from the list, it needs some time to be added to the list again. You can manage this time on the ArvanCloud panel.
- The Origin Server Timeout Period: It is the time that the CDN waits to receive a response from Origin. If the CDN does not receive a response in this restrained time, it means that an error has happened.
Remember that the origin will leave the list in the case that the errors continue to be over the limit. You can set this time separately in the Page Rules section.
The Connection with the Central Server Protocol (Default Settings)
In this section, you can define the protocol (HTTP/HTTPS) via which the CDN connects to the origin.
By default, you should arrange the settings for the ArvanCloud servers connected with the origin servers here:
- HTTP: The connection between the CDN server and the Origin server occurs via HTTP protocol.
- HTTPS: The connection between the CDN server and the Origin server occurs via HTTPS protocol.
- Scheme: The connection between the CDN server and the Origin server depends on the protocol requested by the user. If the user transfers his/her request via HTTP, the connection between the CDN server and the Origin server will happen via HTTP protocol. But, if he/she transfers his/her request via HTTPS, the connection will happen via HTTPS.
If you intend to modify the settings for each domain separately, you can customize the settings in the Records Activation section.
The Central Server Cluster
In this section, you can create different clusters of origins. You can employ these origin clusters in the Page Rules section.
For example, imagine that for a specific rule for the test.com/forum, you want to transfer the requests to a cluster named test cluster instead of the default origin. Then, you should click on the New Cluster option to create a new cluster.
Next, you should type the Name and the Comments (if needed). There are two options, IP and DNS, in the Type section. If you select the IP, the servers list type that you intend to add in the future will be IP. However, provided that you select the DNS, you can add the servers domain name to the cluster.
Now, click on the New Server to add a server to the cluster.
Given that in the mentioned example, you have selected the IP for the cluster type, you should enter the Origin IP server and its port.
The weight option is for this server and will influence Load Balancing. For example, if you have two servers in the cluster (one weighing 100 and the other 50), the number of requests transferred to the former one is twice as many as the latter one.
Now, you have an Origin cluster which you can use to transfer the requests related to the test.com/forum in the Page Rules section.
You should only create a rule for it and set the Origin on the created cluster in the Proxy settings.