Kaixin001.com server architecture Conjecture

Source: Internet
Author: User

Kaixinnet (kaixin001.com) is an SNS service that I often use. It uses a popular lamp combination, at the same time, its Alexa ranks around 134 (the actual data may be slightly different from this). Out of curiosity, I used curl to read a header and crawled the header three times, I found a cookie named serverid in the header, and each time the value is different, three are _ srv101-121 _, _ srv101-142 _ and _ srv134-47 _, in addition, the cookie name should be the server ID. I guess it should be the code of the three servers. Then I will ping the above three IDs + kaixin001.com, they can all be pinged, indicating that my guess is correct.

I guess the architecture of kaixin.com server is as follows: when a user accesses www.kaixin001.com, a server is randomly allocated from the kaixin.com server cluster, and then the server id value is saved in the user's browser through cookies, the user will still use this server the next time they access the server until the cookie becomes invalid (Through my tests, the cookie should be based on the browser memory, that is, if you open the browser again next time, you should randomly allocate a server ID, since it is random, of course, it may also be the same as the last allocated server.). How can I redirect a user to another server when accessing www.kaixin001.com (mainly for Server Load balancer)? First, LVS can be used for processing. In addition, the header contains the word Apache, therefore, Apache's rewrite function may also be used to redirect to another server (However, the address bar remains unchanged.). I have used such an application before. Aside from kaixinnet architecture, nginx can also be used for load balancing, you can also use F5 BIG-IP Load Balancing switch, of course, these here will not elaborate, if you have time, you can find more information on the Internet.

In my opinion, I am not an expert in architecture. If something is wrong, please give me more suggestions and comments!

Results When the Web header is crawled three timesC:/> curl-I www.kaixin001.com
HTTP/1.1 200 OK
Date: Wed, 10 Dec 2008 16:57:27 GMT
Server: Apache/2.2.6 (UNIX) PHP/5.2.4
X-powered-by: PHP/5.2.4
Cache-control: Max-age = 1; private
Expires: Wed, 10 Dec 2008 16:57:28 GMT
Last-modified: Wed, 10 Dec 2008 16:57:27 GMT
Etag: app-1228928247
Set-COOKIE: _ User = deleted; expires = Tue, 11-dec-2007 16:57:26 GMT; Path =/; Domain
= .Kaixin001.com
Vary: Accept-encoding, User-Agent
Connection: Close
Content-Type: text/html; charset = UTF-8
Set-COOKIE: serverid = _ srv101-121 _; Path =/

C:/> curl-I www.kaixin001.com
HTTP/1.1 200 OK
Date: Wed, 10 Dec 2008 16:57:48 GMT
Server: Apache/2.2.6 (UNIX) PHP/5.2.4
X-powered-by: PHP/5.2.4
Cache-control: Max-age = 1; private
Expires: Wed, 10 Dec 2008 16:57:49 GMT
Last-modified: Wed, 10 Dec 2008 16:57:48 GMT
Etag: app-1228928268
Set-COOKIE: _ User = deleted; expires = Tue, 11-dec-2007 16:57:47 GMT; Path =/; Domain
= .Kaixin001.com
Vary: Accept-encoding, User-Agent
Connection: Close
Content-Type: text/html; charset = UTF-8
Set-COOKIE: serverid = _ srv101-142 _; Path =/

C:/> curl-I www.kaixin001.com
HTTP/1.1 200 OK
Date: Wed, 10 Dec 2008 16:58:01 GMT
Server: Apache/2.2.6 (UNIX) PHP/5.2.4
X-powered-by: PHP/5.2.4
Cache-control: Max-age = 1; private
Expires: Wed, 10 Dec 2008 16:58:02 GMT
Last-modified: Wed, 10 Dec 2008 16:58:01 GMT
Etag: app-1228928281
Set-COOKIE: _ User = deleted; expires = Tue, 11-dec-2007 16:58:00 GMT; Path =/; Domain
= .Kaixin001.com
Vary: Accept-encoding, User-Agent
Connection: Close
Content-Type: text/html; charset = UTF-8
Set-COOKIE: serverid = _ srv134-47 _; Path =/
 Ping web server results

Ping the results of "server ID + kaixin001.com" respectively, and the CDN text appears in the ping content. I wonder whether the CDN system is developed by kaixin.com or used by other companies. Cdnunion, like chinacache, can provide CDN acceleration services, but the cost should not be too low.

C:/>ping _srv101-121.kaixin001.com

Pinging www2.kaixin001.z.cdn20.com [119.161.132.21] with 32 bytes of data:

Reply from 119.161.132.21: bytes=32 time=60ms TTL=48
Reply from 119.161.132.21: bytes=32 time=70ms TTL=48
Reply from 119.161.132.21: bytes=32 time=60ms TTL=48
Reply from 119.161.132.21: bytes=32 time=60ms TTL=48

Ping statistics for 119.161.132.21:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 60ms, Maximum = 70ms, Average = 62ms

C:/>ping _srv101-142.kaixin001.com

Pinging www2.kaixin001.z.cdn20.com [119.161.132.24] with 32 bytes of data:

Reply from 119.161.132.24: bytes=32 time=60ms TTL=47
Reply from 119.161.132.24: bytes=32 time=70ms TTL=47
Reply from 119.161.132.24: bytes=32 time=61ms TTL=47
Reply from 119.161.132.24: bytes=32 time=60ms TTL=47

Ping statistics for 119.161.132.24:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 60ms, Maximum = 70ms, Average = 62ms

C:/>ping _srv134-47.kaixin001.com

Pinging www2.kaixin001.z.cdn20.com [119.161.132.21] with 32 bytes of data:

Reply from 119.161.132.21: bytes=32 time=70ms TTL=48
Reply from 119.161.132.21: bytes=32 time=60ms TTL=48
Request timed out.
Reply from 119.161.132.21: bytes=32 time=70ms TTL=48

Ping statistics for 119.161.132.21:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 60ms, Maximum = 70ms, Average = 50ms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.