Common solutions for high concurrency in Java

Source: Internet
Author: User

Common solutions for high concurrency in Java

I. About concurrency What do we mean by high concurrency?

In the internet age, high concurrency, often referred to, at some point in time, there are many visits at the same time.

High concurrency, usually concerned with the system metrics and business metrics?

    • QPS: The amount of queries per second, broadly, usually refers to the number of requests/sec

    • Response Time : The time taken from the request to the receipt of the response, for example: the system needs 100ms to process an HTTP request, and this 100ms is the response time of the system.

    • bandwidth : Calculate bandwidth size to focus on two metrics, peak traffic, and average page size

    • PV: Integrated View (Page view), which is the number of pages viewed or clicked, usually focuses on the amount of pages accessed within 24 hours, i.e. "PV"

    • UV: Independent access (unique Visitor), that is, the number of access to the heavy after the user, usually concerned about the user access within 24 hours, that is, "Daily UV"

Ii. common optimization schemes for three kinds of coping with large concurrency

"Database Cache"

Why do you want to use the cache?

The data is cached so that the client has little or no access to the database, reduces disk IO, increases concurrency, and increases the responsiveness of application data.

"CDN Acceleration"

What is a CDN?

The full name of the CDN is the content Delivery NETWORK,CDN system, which is able to re-direct the user's request to the service node closest to the user in real-time based on the network traffic and the connection of each node, the load condition and the distance to the user.

What are the advantages of using CDN?

The essence of CDN is the memory cache, the nearest access, it improves the enterprise site (especially contains a large number of pictures and static page site) access speed, across the network speed of operators, to ensure that users of different networks have access to good quality.

At the same time, reduce the bandwidth of remote access, share network traffic, reduce the load of the original site Web server.

"Server clustering, and load Balancing"

What is seven-tier load balancing?

Seven-layer load balancing, is based on the HTTP protocol and other application information load balancing, the most commonly used is nginx, it can automatically remove the work is not normal back-end server, upload files using asynchronous mode, support a variety of allocation strategy, can assign weights, distribution mode is flexible.

Built-in strategy: IP Hash, weighted polling

Extended Policy: Fair policy, universal hash, consistent hash

What is a weighted polling policy?

First, the request is assigned to a high-weight machine, until the weight of the machine to lower than other machines, only to start the request to the next high-weight machine, which embodies the weighted weight, but also reflects the polling.

Third, New Year's Gift

In the beginning of 2018, I gave you a little partner who loves programming. A benefit, free online knowledge sharing, occasional Java, cache Redis, high concurrency solutions, self-developed MVC framework, and millions of data volume index optimization sharing.

Common solutions for high concurrency in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.