Day-to-day technical points 2

The full name of JMS
JMS is Java Message Service
http://elim.iteye.com/blog/1893038
JMS message listener (also available in kafka)
http://elim.iteye.com/blog/1893676
JMS transaction management
http:// elim.iteeye.com/blog/1983532

P2P mode: each message has only one consumer (Consumer) (that is, once consumed, the message is no longer in the message queue)
Pub/Sub mode:
ActiveMQ working mode:
http:// blog.csdn.net/qq383264679/article/details/51163144


JMS development steps and persistent/non-persistent Topic messages
https://www.cnblogs.com/xinhuaxuan/p/6105985.html



The difference between Interceptor and AOP
SpringMVC The Interceptor interceptor is used in
its main function to intercept the user's request and process it accordingly. For example, it is used to verify permissions, or to determine whether the user is logged in, or to determine whether the current time is the ticket purchase time like 12306.
http://elim.iteye.com/blog/1750680

Interceptor interceptor (intercept requests, somewhat similar to filters) and AOP (intercept a face, not necessarily a request, a method can also)



Detailed explanation of mybatis dynamic SQL
http://www.blogjava.net/stevenjohn/archive/2012/12/25/393451.html


RocketMQ
http://www.jianshu.com/p/453c6e7ff81c
Send to the same server queue through the same order , so as to ensure sequential and

repetitive consumption, you can
1. maintain idempotency, no matter how many repeated messages come, the final processing result is the same.
2. Use a log table to record the ID of the message that has been processed successfully. If the newly arrived message ID is already in the log table, then this message will not be processed.


Transaction message
1. Directly send the message to the transaction that Bob has debited. If the sending fails, an exception will be thrown and the transaction will be rolled back. (Business implementation)
http://blog.csdn.net/lovesomnus/article/details/51776942


to solve activemq multi-consumer concurrent processinghttp
:
//blog.csdn.net/Seven__________7/article/details/71854992 activemq has a certain mechanism The data in the queue is handed over to the consumer for processing. This mechanism is the allocation of the quantity of data. According to the data, the default is 1000. Therefore, it is enough to reduce this value.


The QR code generation tool
MatrixToImageWriter
Bitmatrix
uses Zxing to generate a QR code, and add a logo to the generated QR code:
http://mygirl1314520.iteye.com/blog/1912109


Front-end generated QR code
jquery.qrcode
http://www.360doc.com/content/16/0426/10/26839592_553877055.shtml
http://www.jb51. net/article/121537.htm
http://happyqing.iteye.com/blog/2294628
https://www.cnblogs.com/songyz/p/7490562.html





Modify request and response content
HttpServletRequestWrapper, HttpServletResponseWrapper
http://blog .csdn.net/it_man/article/details/7556903



springboot multi-environment configuration file selection
spring.profiles.active
http://www.leftso.com/blog/111.html



maven multi-environment configuration file selection
http:// xj84.iteye.com/blog/1135594
https://segmentfault.com/a/1190000003908040
http://zhaoshijie.iteye.com/blog/2094478
http://blog.csdn.net/fengchao2016/article/details/72726101



Page URL access statistics
DruidWebStatFilter
http://blog.csdn.net/u011831754/article/details/71631622



Interpretation of sub-database sub-table middleware Sharding-JDBC
http://blog.csdn.net/u011831754/article/details/71631622 ://blog.csdn.net/cxboyee/article/details/50672969How



to efficiently generate a globally unique ID with an orderly trend. Snowflake
-like algorithmhttps :
//www.cnblogs.com/relucent/p/4955340.htmlSeckill system



architecture optimization ideas Only one request per second is allowed. Site layer: speed limit according to uid, page cache, and return the same content within 5 seconds. Service layer: write request queue according to business to control traffic, do data cache, and perform subsequent log collection processing according to data, other Return to the settlement information. Return to the warehouse, the unpaid return to the warehouse, tell the customer how many minutes to repeat (such as 45 minutes) . One of the architectural design principles is "fail fast". Do request queue control traffic (LockSupport) http://shift-alt-ctrl.iteye.com/blog/2315008














LinkedBlockingQueue, semaphore (specify the bottleneck that the database can accept) (can get the semaphore or can enter the queue to continue execution, can not return the end information)


easyUI
http://demo.topjui.com/?s=jeasyui


realizes thread blocking And continue to run (for the current thread), use
LockSupport for request queue control
http://shift-alt-ctrl.iteye.com/blog/2315008


Semaphore provides a limit on the number of simultaneous access
synchronized, ReentrantLock is a Resource concurrency control, single access

Thread blocking and wake-up: LockSupport
wait(), notify(), notifyAll(), thread blocking, wake-up, wait makes the current thread wait for


the same account, and sends multiple requests at one time. The solution is to write Flag bit
Multiple accounts, send multiple requests at one time. The solution is to use verification codes or the same IP data limit for high frequency.
Multiple accounts, different IPs send different requests. The solution is to improve the level requirements of the account before participating in


capacity design
Capacity evaluation Including data volume, concurrency, bandwidth, CPU/MEM/DISK, etc.
Peak QPS is about 2.5 times the average QPS
Single-machine limit QPS, stress test How to evaluate the capacity of the

Internet architecture design:
[Step 1: Evaluate the total number of visits] -> Inquire Business, product, operation
[Step 2: Evaluate the average traffic QPS] -> Divide by time, 4w seconds per day
[Step 3: Evaluate the peak QPS] -> According to the business graph
[Step 4: Evaluate the system and the limit QPS of a single machine] -> Stress measurement is very important
[Step 5: Answer two questions according to the online redundancy] -> Estimate Difference between redundancy and online


redundancy Problems
in single-point systems (1) Problems in single-point systems: high availability problems, performance bottlenecks
(2) Shadow-master is a common solution to single-point system availability The solution to the problem, keepalive
(3) Reducing the interaction with a single point, is the core direction of system optimization with a single point. Common methods include batch writing, and client cache
(4) Horizontal expansion is also a good solution to improve the performance of a single point system. DNS resolves to different nginx external network IPs. Multiple nginx



background management interfaces can be used to frame the hierarchical relationship of different pages with different js. Each interface must be requested and placed in the frame, and the
client still uses page routing. In order to reduce page requests, frame is not suitable for user-side (front-end of a large number of users)


caching
(1) Eliminating the cache is a general cache processing method (instead of synchronous update)
(2) Eliminate the cache first, then The timing of writing to the database is unquestionable (to prevent the failure of cache elimination)
(3) Servicization is a general way to shield the complexity of the underlying database and cache from the business side


Redundant table data consistency
1. The service layer writes redundant data synchronously
2. Service asynchronous write (introduce message bus)
3. Offline asynchronous write (same principle as database binlog)
4. According to the business, write which redundant table first, and write first if the impact is large
5. Offline full or incremental pair Data consistency check
6. Use message pair to check data consistency (message pair appears within 3S).



Cache and database consistency guarantee
1. Eliminate the cache first, and then write to the database.

Master-slave DB and cache consistency (there is a synchronization time problem)
can use the "cache double elimination" method of secondary asynchronous elimination to solve the problem of inconsistency between the cache and the data in the database.
(1) Timer asynchronous elimination (this article does not elaborate, The essence is to start a thread for asynchronous secondary elimination of cache)
(2) Bus asynchronous elimination
(3) Reading binlog asynchronously eliminates


DB master-slave consistency architecture optimization 4 methods
1. Semi-synchronous replication (wait for master-slave synchronization to complete, write master library
2. Forced to read the main library 3.
Database middleware, record all keys routed to the write library, within the experience master-slave synchronization time window (assuming 500ms), if there is a read request to access the middleware, at this time It is possible that the slave library is still the old data, and the read request on this key is routed to the main library
4. Cache records write key method (similar to method 3)


CAS SSO single sign-on principle
https://www.cnblogs.com/lihuidu /p/6495247.html
http://blog.csdn.net/yuwenruli/article/details/6620947Relieves



high concurrency panic buying through request queue
https://www.cnblogs.com/XiaoyangBoke/p/6701780.html


Ultra-high concurrent lock-free cache
In the [Business Cache] scenarios of [Ultra High Concurrency], [Write More Read Less], and [Fixed Length Value]:
1) Horizontal splits can be used to reduce lock conflicts
2) Map can be converted to Array to minimize Lock conflict, one record for one lock
3) The lock can be removed to maximize concurrency, but the data integrity will be destroyed
4) The integrity of the data can be guaranteed by the signature method to achieve lock-free caching


//If different modules have The data needs to be merged, but you don’t want to use join (possibly separate databases later), and if you don’t want to check them one by one, you can add the in query interface and then merge the data. The


operation log can be implemented by using a message queue, and you don’t need to run the database every time. An example of accessing


springboot jpa to connect multiple databases
https://github.com/itguang/gitbook-smile/tree/master/springboot-multi-datasource



"Configuration" Architecture Evolution
1. Configure private, upstream calls downstream, each The upstream has a dedicated private configuration file that records the configuration information of each node called downstream.
2. Global configuration
3. File monitoring component FileMonitor, dynamic connection pool component DynamicConnectionPool
4. Configuration center, service-oriented


high- availability
service cluster (nginx, RPC), database master-master synchronization, keepalive standby machine, front-end CDN, access layer DNS


data Security
backup , off-site disaster recovery,


high concurrency
Cache, fast invalidation, service cluster, queue processing, message queue, data indexing, sub-database and sub-table, static page as static as possible, stored procedure, batch read, cache delay modification (rewrite database after a certain period of time),


consistency
Transaction, message queue, back-end data verification, cache lock, CAS


real-time (high-performance)
cache, fast invalidation, bandwidth, CPU performance, service cluster, post-processing of message queue for unnecessary processing,


high scalability


Important data You can change the data before and after in the business to record


100,000 timed tasks
. 1. A timer to query whether each task has timed out, which is inefficient
. 2. One timer for each task, which consumes more resources.
3. Timed circular queue, Each task ID is recorded on the circular queue, so that a timer can realize that the task time has reached the set time or has timed out
http://mp.weixin.qq.com/s/mvFwjgxliwx808Hn_9ruEA


spring boot integrated ActiveMQ
http:/ /blog.csdn.net/q672746525/article/details/79295925Improve



the performance of ActiveMQhttp
://blog.csdn.net/yinwenjie/article/details/50991443If



the tree has a hierarchical relationship, and the hierarchical relationship needs to be displayed, you can When associating levels, use "," to separate the relationship of each tree state level, which is convenient for level screening and easy to obtain the name level relationship of the level.



Interface testing tool
jmeter



The background management interface has a small number of users, small concurrency, and high tolerance. You can check the database several times to combine data and return to the front end. The

user system has high concurrency and a large number of users. If you do not check the database many times, you can use multi-level cache. The method of combining data, do not look for requests are put into the database for processing.

For the search of the user system, the cluster (database master-slave multi-database) can be used to deal with high concurrency. It is acceptable for the search user to wait for a while. For other data components in the collection, you can use IN query and then combine the code to reduce the database. Number of queries (reduces database pressure and response time).


The method for the controler to obtain the absolute path:
this.getClass().getClassLoader().getResource("/").getPath(); Here is the classes directory, you can use getResource("/../") to go up one level,
Directly point to the file name getResource("/../xxx.xxx")



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326284908&siteId=291194637