SaaS "Configurable" and "multi-tenant" architecture, technology implementation

Reprinted: https://www.jianshu.com/p/c11b19fc8110

 

According to whether the characteristic "configurable", "high performance", "scalable", we will be divided into four SaaS maturity model.

It is obvious from the figure, the primary maturity model does not have a "configurable", "High Performance" or "stretch" characteristics, and three, four models are based on maturity multi-tenant. So, following the primary open source framework for building SaaS Maturity Model CRM system, how through technical means to achieve "Configurable" and "multi-tenant" structure? Today we'll explore this topic.

A, SaaS "configurable" technology implementation architecture

Use metadata modeling MDA (Modle Driven Architecture, Model Driven Architecture), we realize that "Configurable" of common technology architecture.

MDA, is in response to "since the 1990s, the basic platform technology tools and rapid iteration, as well as numerous system integration and transformation demand increased sharply," the trend proposed to solve the "rapid changes in business and technology, to software practitioners give the "model difficult to deal with technical problems.

It "platform technology to achieve" separated by "enterprise applications" and, platform-independent PIM (Platform Independent Model) unified modeling language, and platform-specific PSM (Platform Specific Model) model of the way, encapsulate "enterprise applications "and" purpose technology platform change, "both reached the technology to reduce interference, simplifies technology developers work.

1. MDA architecture

 

 
 

The inner ring: MDA mainly uses UML (Unified Modeling Language), MOF (Meta-Object Facility) and CWM (Common Warehouse Metamodel) three modeling standards, as PIM and PSM modeling foundation. However, the general developer, as long as the well-known UML unified modeling language, you can develop MDA project.

In the ring: to achieve a platform for open standards or proprietary technologies, including CORBA, XMI / XML, .NET, JAVA and WEB SERVICE, and so on. MDA hopes to develop a variety of platform-specific PSM transformation rules by the manufacturers with the design MDA development tools, it will be automatically converted to neutral PIM platform exclusive PSM model.

Outer ring: cross-platform universal service representatives (Pervasive Services) - directory service (Directory Services), Transaction Service (Transaction Services), security services (Security Services) and distributed event and notification service (Distributed Event and Notification Services), the purpose is to let the application or client on any platform, are available through MDA environment, we have made cross-platform services.

Out of the loop: On behalf of MDA can be used in all kinds of different areas of the environment, such as e-commerce (E-Commerce), Telecom (Telecom), health care (HealthCare), Transportation (Transportation), aviation (Space), manufacturing (Manufacturing) , Finance (Finance) and other fields.

2. MDA four-layer model of

 

 
 

Example M0- layer: Examples of the model M1 layer, i.e., corresponds to a specific program UML model.

M1 - layer model: Modeling is commonly faced by persons, such as UML model diagram, is to analyze and design, including the developers of the most familiar.

M2 - metamodel layer: metamodel corresponding to the M1 layer model (UML, SPEM, etc.), by extracting the relationship between different areas of the structure and abstractions, symbols M1 to provide a modeling layer model, providing a corresponding modeled as different areas language.

M3: meta - metamodel layer

MOF this layer is located, provides a more abstract modeling support layer defined meta-model M2 required level. MOF is a meta-model M2 layer metamodel all, while it is also self-describing, MOF MOF meta-model may describe itself. Note that in the MDA framework, M3 layer of only MOF this model, which is MDA is the most basic and core standards, it provides a unified semantic basis for all model / metamodel MDA framework, so that the unity based MOF's model operation possible.

3. MDA development process

The first stage: CIM (Computation Independent Model) - focused on the environment and the needs of the system, but does not involve structural and operational details inside the system.

The second stage: PIM (Platform Independent Model) - focus on the internal details of the system, but does not relate to the specific platform system.

The third stage: PSM (Platform Specific Model) - focused on the system, implement platform-specific details (such as EJB, J2EE or .NET is a kind of platform-specific), and with a unified programming language UML modeling the PSM.

Phase IV: Coding - based on UML model PSM content, according to the drawings, write the code for a particular platform-specific.

Two, SaaS "multi-tenant" architecture, technology implementation

Selecting a data storage mode

Multi-tenant (Multi-Tenant), i.e., multiple tenants share one example, the tenant data both have a shared isolation, the final analysis is to solve the problem of data storage.

Common data storage in three ways.

Option One: Independent database

 

 
 

"A Tenant, a Database" of data storage. Highest level of isolation, the most secure, but the cost is high.

advantage:

. A separate databases for different tenants, helps to simplify the design of the extended data model to meet individual needs;

. B simpler data recovery;

Disadvantages: increase the number of database installation, the purchase and maintenance costs;

Option Two: a shared database, data architecture isolation

 

 
 

Multiple tenants or all tenants share the Database, but a Tenant, a Schema way.

advantage:

. A certain degree of data isolation logic (not completely) to meet a higher degree of security protection;

. B Each database can support more number of tenants;

Disadvantages:

. A data recovery more difficult, because the data would involve other tenants;

. B Cross-tenant statistics difficult to achieve;

Option Three: a shared database, shared data architecture

 

 
 

One kind of tenants share the same Database, the same Schema, and further by way of tenant data TenantID distinction.

Pros: Each database can support the number of tenants, low maintenance and cost of ownership;

Disadvantages:

A. Low isolation level, security is low, need to do a lot of development work to develop safety;

B. table one by one by backing up and restoring data, data backup and recovery difficult.

Comparison of Three data storage schemes

 

 
 

But how exactly is selected, depending on the product and pricing strategy for data security tenant acceptance.

2. System Security Design

System level:

A. Use HTTPS transport protocols SSL (Security Socket Layer) to exchange data, Secure Communication

B. Use of digital signature, to prevent the transfer process is tampered;

C. using the DES data encryption algorithm, the user identity design;

D. scheduled backup service data;

Program level:

A. Configuration permissions (permission function, data permissions, etc.)

B. Client input validation, and JS XXS prevent attacks, SQL injection and the like;

C. secondary safety design, such as password control, image verification, phone validation.

3. Tenant Management

Registration, ordering and billing management.

registered

 

 
 

Tenant: Tenant

User: User under the tenant, under the same tenant can have multiple users;

Tenant's status property to define the tenant status (pending, review, enable, disable, cancel), the tenant can give permission landing.

order

 

 
 

PricePolicy: pricing strategy, supported by time (year, month, day), the number of pricing to unit represents;

Subsciber: order history, recording the tenants choose what pricing strategy, as well as length of service or service number.

Billing

 

 
 

Journal: running account, using logging service tenants, and for generating billing reports;

4, data isolation

 

 
 

For each business need to isolate the table plus Tenant_ID field to achieve data isolation between tenants, this is the most common practice.

(Refer to part of the network)

Public number (ID: 9z Marketing Big Data)



Author: White Orange
link: https: //www.jianshu.com/p/c11b19fc8110
Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Guess you like

Origin www.cnblogs.com/Jeely/p/12325668.html