Thinking Saas system architecture, multi-tenant architecture design analysis Saas

        ToB Saas fire system is very recent years. Many start-up companies are trying to create enterprise-level applications cRM, HR, sales, Desk Saas system. Many start-up companies also took a large Saas venture. After all Saas advantages compared to the traditional software is very obvious.   

The most recent year, the honor system architecture of a Crm saas, on the line for months, in all aspects than satisfied. The whole system creation process, step on a lot of the pit, the harvest will be more. To summarize Saas system architecture features:

Saas grading system :

5 level SaaS maturity model architecture - from the "chaos" to "Utopia"

The first level (confusion) 0 : Each time a new client, a new instance of the software will.
Level 1 (controlled chaos) : All clients are running on the same version of the software, and any of the customization are achieved by modifying the configuration.
Level 2 (multi-tenant [multi-tenant], high-rise buildings [Highrise]) : All customers are ready to run on the same version of the software, and they all run on the same "instance."
Level 3 (multi-tenant, the expansion [Build-Out]) : At this point you already have a multi-tenant, single version of the software model. But you can still be extended by hardware extensions (scale-out) manner.
Level 4 (Utopia) : Like Level 3, unless you can find an effective way to run different versions on different "instance" of software .

Applications must support multi-tenancy:

    Multi-tenant can be divided into several different categories (e.g., below the list shown in FIG.):
    1.1, simple cloud virtualization, wherein only the shared hardware.
    1.2, shared applications, use a different database for each tenant.
    1.3, shared applications and databases (the highest efficiency, true multi-tenant).

1. hierarchical design

Saas hierarchical system is about:

Saas System Hierarchy
Saas System Hierarchy

 

Saas system hierarchy : tenant identification> Application Layer> data access layer> buffer layer> Database

Business codes are written in the application layer.

Tenant identification may be implemented spring interceptors, then transmitted to the rear ThreadLocal

Databases and caching layer to the application layer should be transparent. When programmers write code, and only care about business logic, we should not worry about multi-tenancy.

 

2. Data to be transparent isolation

saas system that is simple, any system seems to add tenant_id (tenant id) becomes saas the system. For example, the original user login is:

select username,password from users where email='[email protected]'

Change

select username,password from users where email='[email protected]' and tenant_id =1;

For saas complex business systems, so practice is very dangerous and very low development efficiency. If you think about the time that programmers write sql forgot to add "and tenant_id = 1". The results could be disastrous.

Better approach is to rewrite the SQL database access layer.

TenantContext.exec("select username,password from users where email='[email protected]' ");

Sql rewritten according to the connection pool TenatnContext. 

So good is that, a program to ape the system up to get down, and you will not be a string of information leaks from each other. And secondly, the future make points table and warehouses is also very convenient, the upper application without modification.

3. Tenant identification scheme

Better approach is to identify the tenant by url. The system is to generate a random tenants of third-level domains, such as abc.crm.baidu.com. If customers want to use your own domain name, we can go to the third-level domains generated in cname, and management systems which do bind.

Such a tenant can have two domain names, access saas, a randomly generated third-level domains, the other tenants own domain name. May come inside the code name, to determine that the tenant is then initialized TenantContext.

If you do not want to do through the domain name, it can be judged by the login name. This way to involve tenants switching problem.

4. Intelligent DNS

After the supplement.

5. Tenant management systems (billing, ordering, custom, top, calls)

Saas-tenant system is a billing system and a control system must be considered. This system is a separate design needs. For example, the tenant purchase those modules, how much money a month. Tenants can create a maximum number of users. Billing due mail alert function.

There are two general accounting mode, periodic billing, monthly similar programs, and the amount of billing, with how much to pay. Periodic billing is relatively simple. You can also combine the two.

6. customized development

SAAS advantage is that the system uses a set of people, it seems that there is a conflict and customized development. A customer wants features such as A, B customers do not want. However, customized development can not be avoided, such as CRM systems such complex system, a system can not meet all the requirements of the company. Customized development as subsystems, sub-module to do it. Then configure the different modules ordered by different tenants console, those modules can be displayed on the front page. Different subsystems need to be deployed separately. The distal end may be distributed through url Nginx, such abc.crm.baidu.com/bi/xxx/xx this address, it is distributed to the BI subsystem. Do not try to engage in a modular OSGI, this is a pit.

As well as product development and existing demand analysis must be clear, not to find a recipe for disaster on the line. New features can be configured independently to do as much as possible.

7. Upgrade gray

SAAS paying business customers are particularly sensitive to system problems. In order to reduce the scope of upgrade issues that may arise, generally used gray upgrade strategy. If the url to distinguish between different tenants, gray upgrade configuration will be very convenient. May be configured to be distributed according to nginx domain, such tenant A (aaa.com) to Example 1 (Version 1.0), tenants B (bbb.com) to Example 2 (versions). When it is desired configuration is more time domain, the configuration nginx documentation will be chaos. This time to consider using nignx_lua to write some extension modules.

8. Sizing

 

9. Saas platform architecture stratified analysis

Saas platform architecture needs to be done from the user application saas link to the whole process of application users buy their own function module, the user plays with saas seemingly simple and quick, but this process requires saas platform architecture has quietly completed a very complex process. By understanding saas platform architecture, the process can be clearly differentiated data, allowing users to understand the advantages of saas platform architecture for processing data. Here: saas platform architecture is divided into several parts.

 

saas platform architecture the presentation layer:

saas platform architecture can be used in the presentation layer clients may have browser or local client. If you need is a Web browser interface technology, interactive technology and other technologies (such as: HTMl5 technology, CSS3 technology, Ajax technology, etc.) support if you need a software client remote desktop technology, software, interactive technology and other technical support.

saas platform architecture of the scheduling layer:

saas platform architecture scheduling layer reflects one of the characteristics of distributed systems. Is responsible for identifying and scheduling layer is first AAA authentication request by each user, then the load reasonable scheduling, traffic characteristics of the traffic processor. You can scale through the application of such architecture SaaS platform. Also in storage, caching, etc. In order to meet the needs of scale, scheduling level platform also must have good scalability.

saas platform architecture of the business layer:

saas platform architecture business layer is responsible for receiving scheduling requests forwarded by layer, but also to perform the actual business logic of the received request. In general the implementation of business logic using a single server is enough. Thus the actual business layer is constituted by a row composed of server peer, each server perform the same business logic.

saas platform architecture of the data layer:

Saas platform database cluster architecture for processing and storing strong relationship for demanding transactional business data, such data are currently still using traditional database clustering technology to solve, database cluster saas platform architecture is mainly based on business wherein split developing the program data. (: The user operation log) while the mass but the relationship is not strong distributed database for storing data.

These are "thinking Saas system architecture, multi-tenant architecture Saas analysis" of the introduction of saas platform architecture can be seen from the data processing application saas platform has a strong advantage, such as user saas very convenient and simple as long as the browser or native client interface, saas platform processes data to go through layers certified safe and reliable product saas, saas saas platform optimized data to improve performance.

Saas multi-tenant system architecture should also meet the following requirements:

Numbering demand description
1 Software Licensing Cloud platform payment authorization mechanism, according to time, function, and so the number of paid licenses
2 Organization settled It allows organizations to take the initiative to apply to join the platform
3 Verified Personal real-name certification, real-name certification organization
4 Qualification examination Quality audit individuals and organizations, such as to obtain a certificate of honor or review
5 Binding organization Personal account to bind organizations to establish relationships with organizations
6 Organizational unbundling Personal accounts and organization unbundling
7 Account cancellation Personal accounts written off, and destroy all personal information and files
8 Unified login That SSO
9 Unified registration To provide a unified user registration page

Part of data compilation from:

http://www.ruanally.com
​​​​​​​http://qk.gam7.com
​​​​​​​​​​​​​​http://www.ruanbe.com

 

Guess you like

Origin blog.csdn.net/cnpinpai/article/details/91967335