[Spike] two, what? Spike engine can do?

Original: little sister the taste (micro-channel public number ID: xjjdog), please share, reproduced Please keep the source.

Spike system is a complex thing, from our previous article can be seen, eloquent smelly and nearly 5,000 words long. Such a complex thing, if each system to be written once, is bound to be a very big human waste. One aspect of ill-considered, would have lost.

From the last in the group chat technology exchange spike to design the system so far it has recruited 8位its junior partner of great interest, writer coding. After our discussions, except to make sense of a spike demo, we can step closer, make it into a spike engine.

Here, xjjdog will share the process. The result is not important, important is the idea and process. You might get some 框架类experience in the development of the code, so it might hope.

[Spike] two, what? Spike engine can do?

A black box

The main idea is to kill the engine as a black box, the logical completion of the spike shield. End of the input, output end. In other words, you want to spike the data, after washing pour spike engines, the rest no matter what the original system.

"Delicate spike engines, cloud acceleration, high availability resilient scalable architecture .SLA annual 5 9, green pollution-free, for your business escort. Professional pre-sales technical support to help you through the optimal configuration." Is not very familiar nonsense slogan? This is the black box, I just completed a function, you control me are monsters.

Abstract concept

From the process is concerned, we will spike code also classified into three stages: preparation, spike, liquidation. In order to accomplish the above objectives, resources still need to be further involved in the abstract. Here are some initial set of concepts, follow-up or change.

actor spike participants

According to the literal meaning, we can see here is the abstract of the main operation, that is, the people involved. actor will be attached with a number of information, such as basic information of the user. In this way, we can achieve some individual flow control strategy, or risk control strategies. For example, if there is a logic: new registered account is not eligible to spike. Then the actor's additional information, it should contain the user's registration time.

queue buffer queue

Spike request queue buffer, it is first landing place. Whether it is the memory queue, or distributed queue, in fact, the operation are similar. We also look at them abstract. Thus, the configuration parameters, the behavior and performance can be adjusted spike queue.

source data source spike

Data providers. Data may come from an external database (db), from the outside may push (push), the external interface may also come from pulling (pull). The data acquisition process, we gave it a name, called the source. Of course, this part of the extended functions are possible, such as data from a source ES.

sink sinking ground spike data

The main spike after treatment is completed, the destination of the data. Similarly with the source, which is a reverse operation. The process is similar to a class of stock deduction of floor action. The behavior of the component, perhaps push, or maybe an event to send messages directly. source and sink, the composition of a specific data flow to spike goal is something other than black box.

target spike goal

It is time to spike a name the target. It has a spike in engine unique name: targetID, which is used to identify a commodity. Very, very much personalized configuration parameters here, such as spike start time, queue length, whether lazy loading goods.

stock inventory operations

Stock operation is an operation means in the black box, the information will be combined from time to time, to the business end of the sink. The operation of the stock, it is necessary to ensure its accuracy and throughput. This is also one of our core concept.

action action

Similar action message bus. Action, action, refers to a vector of all actions arising actor, throughout the life cycle, is immutable (Immutable). Action will be buffered, tracking, scheduling, recording, are interspersed throughout the engine's behavior entity.

runtime real-time operating unit

runtime changes for spike message buffer chaotic period, in principle, be logged and sink. We will do a lot of running unit operation and judgment until the final data, to BASEthe state.

The main flow

aims

Spike engine will use a variety of technologies, we have to hand to twist, but also need a way to share. + Source code with the tutorial way, there will be better results. To ensure the robustness of the program, we will use unit testing, code coverage as much as possible; To evaluate the performance of the entire system, we will introduce some of the pressure testing tools; and finally, the project will use a springboot integrated spike engines, do a final effect.

Wherein the portion of abstraction, to be able to do dynamic replacement, and provide customized extended mode.

Tentative technology selection

Spike engine consists of three parts.

1, the core of
the module assembly will depend as little as possible, in order to be used in various development environment (just Spring), covering the important concepts and implementation logic. It will be particularly fine adjustment of the configuration parameters for performance.

2, demo part
using springboot, vue, flutter, etc. The most popular technique to show a complete example.

3, part of program
optimization for some special scenes, or an extension of the theme, the program has a typical representative issued.

In one word the most marketing force, it is 行业解决方案.

Code

Project code in github, present only part of abstraction. Interested can be tracked.

https://github.com/xjjdog/seckill-engine
复制代码

Little sister the taste of the public micro-channel number keeps track of state changes and technology worth mentioning, by way of practice, some knowledge of the past and interspersed review.

Welcome to add my micro letter, put forward your valuable comments.

About the Author: little sister the taste (xjjdog), does not allow the public a number of detours programmer. Focus infrastructure and Linux. Decade architecture, day ten billion flow, and you explore the world of high concurrency, give you a different taste. My personal micro-channel xjjdog0, welcome to add friends, further exchanges.

Guess you like

Origin juejin.im/post/5d7704fc5188254cf531afb5