On architectural design support one million

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/change_on/article/details/91041888

Look at the map, look at the overview:

Here Insert Picture Description

The figure is the architecture of the past few months to develop a summary, according to a one point of view, right to left,
look at the two on the right, can be classified as a class, this part can be called a dependency, as a common part. In the design of the framework, first consider the application framework for each component, the substantial portion of these frameworks written, packaged into dependent packages, to the service system call. These sections include the following basis:

  • Cache: redis redis address, port, thread configuration read from the configuration file, the connection release are made redis tool that provides an interface only
  • Log: recommended log4j
  • Messaging middleware: kafka cluster, packaging factory configuration, providing producers, consumers Interface
  • core: certification authority, stopped and checked
  • File System: ftp / fdfs, file management, providing upload and download interfaces
  • Database: mysql
  • Persistence framework with mybatis: service provides an interface
  • Tools: base64, map, email ...

The third column on the right as a business, according to the needs, the vertical slicing operations, the external service providing an interface to make a subsystem, a logical processing subsystem, the underlying operation as a subsystem, via intermediate communication kafka. So here it comes to a question, deployment time, with each business subsystem to many machines in order to achieve the best treatment effect:

  • A single machine: make a thread of control in place to receive kafka, allowing a single machine to run the largest thread in the case of resource depletion
  • Deployment: Recommended to deploy each one, after the stress test, print out the cpu, jvm, graphs utilization of the written document is written, the large increase in the utilization of the machine, so that their resources are best run over (85 %the above)

Leftmost one on the external

  • nginx load balancing
  • Visualization can find internal tasks
  • Server downtime monitoring system which monitors

These are design, as well as the database to read and write separation, CDN and the like do not say. Here is the code for a more detailed level. Only one external business, the most pure internal back-end code, java-based implementation is strongly recommended two books "thinking in java" and "effective java", affecting some of the disapproval of the habit at high concurrency too! ! !
I share a few coding skills:

  • Multithreading place using a thread pool, try not new thread
  • Creating objects on the outer loop, created the better
  • Duplicated code by conventional design considerations mode, a single embodiment, adapter ... ;.
  • Integer replacement int
  • More reading, hates few books to use when

Guess you like

Origin blog.csdn.net/change_on/article/details/91041888