mmdbcn 发表于 2016-11-22 08:24:53

RESTful API后台系统架构设计(Java)

  最近设计和实现了一个JAVA的RESTful API的后台业务系统架构,主要基于Java平台。设计要求是:

   
[*]性能:平均响应时间(RESTful API)小于2s(平均负载的情况下),并发访问200个以上。   
[*]可用性:99%,87.6小时每年宕机时间   
[*]伸缩性:允许负载均衡集群水平扩展web server和application server。保留半年的历史数据。可以扩展。   
[*]安全性:具有基于RBAC的角色和权限控制;提供SSL链接;可以和LDAP集成;可以通过PCI/DSS安全认证标准。
  可以看到系统对可用性和性能要求一般,但对安全性要求较高。整体设计架构:

  之所以采用关系数据库和NoSQL混合模式,是因为系统有很多视频和图片文件,而且需要保存历史,所以这类数据存放在NoSQL数据库中。
技术选型

  展现层:

   
[*]Spring MVC - MVC Framework   
[*]Java Server Pages (JSP) - View Generation   
[*]ExtJS - Javascript UI Widget Framework   
[*]Spring Security - Security Framework   
[*]Jackson - JSON Generation / Parser   
[*]Jersey - JAX-RS 2.0 Implementation
  中间层:

   
[*]Spring Beans-IoC Container   
[*]Spring Transaction -Transaction Management   
[*]Dozer -Bean Transformation Framework   
[*]Spring Security -Security Framework   
[*]Quartz Scheduler -Scheduling
  数据层:

   
[*]Spring Data - Convenience API for Hibernate & MongoDB   
[*]Hibernate-ORM Tool   
[*]RDBMS-PostgreSQL   
[*]NoSQL DB-MongoDB
  公共:

   
[*]Java Development Kit - Core Platform   
[*]Spring Beans / IoC - IoC Container   
[*]Spring AOP - AOP Framework   
[*]Logback - Logging API   
[*]SLF4J - Logging API Abstraction
  其它:

   
[*]Application Server    - JBoss AS   
[*]Distributed Cache    - EHCache
系统部署图

  上图可以看出,前端入口是负载均衡和反向代理(Apache HTTPD with mod_proxy and mod_balancer),中间是JBOSS应用服务器集群,后面是两台统计服务器(RServer),然后是关系数据库集群和NoSQL。
  高可用方案:

   
[*]Primary / Stand-By Load Balancers   
[*]Active / Active Application Server Cluster   
[*]Active / Active Analytics Server Cluster   
[*]Active / Passive RDBMS Cluster
  系统上线运行以来基本满足设计要求。
页: [1]
查看完整版本: RESTful API后台系统架构设计(Java)