Technical solution of Zhihu -- Python-based Tornado framework

Source: Internet
Author: User
Tags virtualenv
Zhihu's overall website architecture is as follows: Zhihu is a website rarely developed using Python in China and is worth learning, from Zhihu, we can also learn some new WEB technologies. I. Python framework I currently use Tornado & nbsp; framework. Tornado is a Pytho

Zhihu's entire website architecture is as follows:

Zhihu is a website rarely developed using Python in China. it is also worth learning. Zhihu allows us to learn some new WEB technologies.

I. Python framework

Is Tornado currently used? Framework. Tornado is a Web Server and Web application framework written in Python. it is used by FriendFeed on its own website, FriendFeed, after being acquired by facebook, the framework will be open to the public in the form of open source software.

Reference: http://zh.wikipedia.org/wiki/Tornado

Learning documents: http://www.tornadoweb.cn/documentation

II. Database

Currently, MySQL is used as the primary storage, and SqlAlchemy is used? Model or map databases for ORM.

III. cache technology

Apsaradb for Redis is used for caching, queuing, counting, or tasks, and Redis-Py is used to connect to the client.

Redis reference: http://redis.readthedocs.org/en/latest/index.html

Redis-Py reference link: http://redis-py.readthedocs.org/en/latest/index.html

IV. Javascript framework

Zhihu uses Google's Closure Library as the front-end JavaScript framework.

5. load processing

Currently, nginx is used for reverse proxy, and nginx is used for static files and other large data volume I/O operations.

VI. image service

Zhihu's previously used Upyun has now been migrated to Zhihu's image service.

VII. email service

Zhihu's mail was initially sent using Amazon's SES. as SES does not meet requirements, it has been converted to Mailgun.

8. message system

Zhihu message system adopts the comet implementation, and comet is a "server push" technology based on http persistent connections.

IX. virtual environment

As a Python website, it is very likely that Virtualenv is used to solve Pure Package environment problems.

Chinese document address: http://virtualenv-chinese-docs.readthedocs.org/en/latest/index.html

10. code deployment

Common Python projects are basically deployed using Fabric. I don't know which one is actually used.

11. search implementation

Zhihu uses mmseg for Chinese word segmentation. the corresponding word root exists in redis as the key, and the database id as the value. each data item is a zset set. Find the corresponding value based on the key during the query.

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.