[Practical] to provide APIs for the app, the architecture of how to design, need to consider high concurrency, access is relatively large

Source: Internet
Author: User

provide API for app, architecture How to design, need to consider high concurrency, traffic ratio is large

Reference: Http://zhidao.baidu.com/link?url=D_ TRX6MLKQEZ9LXW7YD58NB53MGIKTFSKDVWRHSEOD4LFKD6IY0WXVRDX6VLE2RUBKLVPS9EJJE5BZ3U5UJKCBJVHFUWS5P0BQVLPWEBXHW2015-04-13 21:58 The questioner adopted
1. About rest, just a style, as for the framework, spring MVC is relatively mature, in fact, this MVC framework will not be your problem, from the team proficiency and extension, Spring is a good choice, this piece as long as you design, open API is more convenient.

2. On the database, if it is a large amount of reading, such as reading and writing ratio 10:1, the traffic is relatively large, you can consider the master and slave of the database, as well as load balancing some things, about this piece of things, have to deal with the actual situation. As for the points to consider, you have to consider database stress, information monitoring, downtime, and so on, and you might consider your level scaling issues later.

3. About the database part of the framework, I do not understand that, although the database as a storage, you can not put all the pressure on the database side, in the case of large traffic, you should consider the cache framework, like common memcache similar are more mature, as for the cache framework selection, You have to choose according to the volume of your business. Once you choose the master-slave or the so-called read-write separation, plus the cache, you have to consider synchronization, transactions, and some failures and other unexpected situations, it is very troublesome, these are just a thought.

4. The above may be a bit more, in fact, simply say, a large number of traffic cases:
A. Reduce server request pressure, you can use an nginx-like load-balanced framework
B. The database access pressure, the same you can deploy more than one, master and slave separation.
C. In most cases, consider caching frameworks, which can reduce a lot of stress for you
The above 3 points basically can meet your business, of course, more troublesome things, more, the direction is so.

5. High concurrency write code, as long as you know the rationale, in fact, it is not difficult. The so-called concurrency problems are mainly afraid of the time of writing data errors (confusion), in fact, the situation is to be afraid of efficiency and deadlock problems, data will not be wrong. After the master-slave separation, the general situation of reading data will not be locked, the real-time data, it will not require so high. This is a lot to consider if you have a large number of writes. If you want to pay attention to something, you have to pay attention to the read and write control of the shared variable, that is, the operation of the object with the state of attention, the other is generally the database level.

6.ibaits updated into Mybaits, this is the ORM framework, can be convenient for you to develop, there is no good to do, feel convenient is appropriate.

7. Above are some general methods, I think monitoring is very important, you need to know where the problem is, to know how to improve, and stress test must have, otherwise you do not know whether or not satisfied.

8. Some small suggestions, please point out, do not spray ~. ~





[Practical] to provide APIs for the app, the architecture of how to design, need to consider high concurrency, access is relatively large

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.