问题原文
原帖链接 · Master Iori · CC BY-SA 3.0
I have a WordPress website. These days I'm having physical memory limitations. I tried to fix it and did well except the memory usage (RAM) usage is still high. Not as high as before, but still not good.
I have a Linux hosting with cPanel in Godaddy which is where my domain is based, and I have another hosting on Obambu. Can the domain work under the two hosts? I mean with the same database and both servers presenting content to users?
已采纳解答
原帖链接 · Stephen Ostermiller · CC BY-SA 3.0
There is a technique that could make it work, sort-of: round robin DNS. You can add two DNS records for the same name with two different IP addresses. In theory, clients should get one of two of the IP values and half your traffic should hit each of your servers.
In practice round robin DNS has problems:
- One of your servers will end up getting more traffic than the other. This is due to DNS servers making a choice for all their users and serving just one of the two values to many users.
- If one of your servers goes down, the half of users that would hit it won't be able to get to your site. There is nothing that will route them to the other server that is still up. This makes your site twice as fragile as it was with only one server and makes it hard to do scheduled down time and maintenance.
It is better to get two servers at the same web host and put a load balancer in front of them. A load balancer only works on a local network, but it routes traffic to servers based on whether or not they are actually up. It also allows you to control traffic percentages much better.
With either round robin DNS or a load balancer, you will need two central things to run WordPress:
- Your database which stores posts and users
- Your
wp-contentdirectory which stores images and themes
To use two servers, you will need to set both of them up to use a central database and a network file system for wp-content.
Another option is to continue with a single server but put a content delivery network (CDN) in front of it. A CDN is a set of caching proxy servers designed to be close to your users. A CDN will reduce the load on your main server while making your site faster for users. Because there is caching, it is hard to use this technique with highly dynamic websites.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
