Home Java javaTutorial The road of Java architect--current limiting technology and various programming languages

The road of Java architect--current limiting technology and various programming languages

Jun 26, 2017 am 11:48 AM
how technology Architecture Limiting

The programming languages ​​currently on the market are mainly object-oriented. Object-oriented must start with some of the most basic things. For example, I got married at the age of 24, otherwise how could I do object-oriented programming. And then you have a baby right after you get married. What if the partner runs away? A new one? If creation and destruction are expensive, it is better to have a child and continue to hold a reference to the object.

Why do some people talk for a long time when they open their mouths, while some people talk only once in a while? According to my observation, two people who work almost equally well will develop better in the future. Let’s feel the reasons from specific examples.

When chatting with friends, really, Renren, which came out a few years ago, always has a bit of a technical geek spirit. When we chat, we talk about technology. People ask me how your videos are stored and played. I said that I only work on content and meta, and the rest has nothing to do with me. Tian'er chatted to death, and his pattern fell into place. If there is a development platform for what I do, it includes uploading videos. First call the cloud storage interface for initialization, and they return us a video media upload URL. The JS side uploads media fragments to the URL. If the network is interrupted or the browser is closed or something, you can call the resume upload interface to continue uploading using the newly returned URL. The resume transfer interface carries the total file size and the size of the files that have been received so far. JS can use this to determine which fragment to continue the transfer from. Cloud storage is in another department. They are responsible for communicating with the cloud transcoding department. Cloud transcoding converts media into various formats. As for converting original high-definition files into various bit rates, how is sampling done, and DRM digital rights management is How to do it is the responsibility of the cloud transcoding department. What strategies do they use internally to distribute it to various DNS nodes? How the scheduling department schedules to save the most precious bandwidth of the video website, I am not very clear about the specific details. The cloud transcoding department passes the converted bit rates and video URLs to us in the form of MQ, and we store them in the database.

Then they asked again, what do you use for MQ? I'm talking about apache's qpidd. Um~~, if people don’t know, the conversation will be boring. So it must be said that MQ is similar, and like rabbit mq, it is based on the AMQP advanced message queue protocol. This is the company's unified cluster, and it is said to be very convenient to install and deploy. Mainstream programming languages ​​also support it, so I use it. Because it is mainly cross-department communication, it is mainly for convenience and saving communication costs, so our message body is json first compressed and then base64. We also don’t use the binary ones of protobuf, because if we encounter a problem, the binary is poorly readable, lacks self-description, and is not easy to troubleshoot.

High-concurrency services must have some emergency plans, such as service interruption, downgrade, isolation, current limiting, asynchronous RPC, etc. For service interruption, downgrade, and isolation, everyone prefers to use Netflix’s open source distributed service elasticity framework Hystrix. Hystrix can also limit traffic. But our service uses guava's RateLimiter, a mature token bucket algorithm, to implement it.

Service current limiting is a very simple matter. Our code only has a few hundred lines, but it contains a relatively complete set of design ideas. The purpose is to implement fine-grained business current limiting based on certain strategies (such as url, platform source, url + platform source).

 

All requests must go through this interceptor. A single current limit holder is defined in this interceptor. This current limit holder is configured according to the configuration. A map composed of the policy and the configured limit for each or each request is returned to the interceptor requesting the corresponding key and RateLimiter. If the interceptor determines that the limit is exceeded, an error will be returned directly without being handed over to the controller for processing. A request type, such as url, a RateLimiter for fine-grained rate limiting.

Of course, in addition to this application-level current limitation, some restrictions on IP session space, request frequency, and concurrency can also be implemented at the nginx level. If you encounter a network attack, try to solve the problem from the operation and maintenance level first, because the higher the level, the impact on services can be minimized.

A good software architecture can meet the quality of the system, enable beneficiaries to achieve consistent goals, support the planning process, guide system development, effectively manage complexity, and lay the foundation for reuse. The foundation can reduce maintenance costs and support conflict analysis.

Most architectures or programming languages ​​come from projects. For example, Stroustrup, the inventor of C++, originally designed this language because he saw that C language caused critical programming problems due to unreasonable initialization parameters. Such bugs are difficult to find. This problem also occurs during cleaning. If you do it and persist, you will indeed succeed. However, everything has a stage of formation and development. Java has been complained about performance issues in older versions, and every version of Java is accompanied by performance improvements, so upgrading the JVM can bring free performance benefits. The final keyword comes to mind when it comes to details. In early versions, the part of the final keyword would be called inline, directly expanding the function without the need for constant pushing and popping of parameters into and out of the stack, which would cause performance overhead. But this will cause a relatively large space overhead when the function body is large. The JVM has been optimized since 1.5, and the final keyword is no longer so important in performance. It turns out that there is a colleague in the company who is very nice and has great ideas. He said: "I always record some of my ideas in a notebook, and then when I look at it after a while, I will find that I only insisted on one of the ideas at the time, did it, and it was successful." I think he is further away from success than he thinks. Because all he had was an idea, but he didn't do it. It seems that there is only the idea of ​​​​JDK1.0, but the distance from success is at least jdk1.5.

Python is famous for its small code size, low maintenance cost, and high programming efficiency. But how many programming languages ​​are not optimized for low maintenance costs and high programming efficiency? So people asked me that search engines are already in flames. Can you really create your own advantages in the future? All I can say is how will you know if you don’t try. "Life is short, I use python". These features of Python can free up more time to pick up girls, but life is short. The advertising words of Python authors give Python vitality. In fact, the simplicity of Python can be seen from its memory recycling. It uses reference counting, so there is no circular reference problem. I did a python project when I was at Renren. There was a time when our leader said that I did the work of eight people by myself. In addition to all the maintenance work on the entire website, I take on all kinds of new jobs. Because of this personality, others really have no way to come to me. I only embarrass myself, not others. At that time, I had been working for less than four years and had been programming for less than two years. I said that I worked as a Japanese translator for the first two years of my work. The reason why we can go to everyone. I just came to Beijing one day, and I was visiting the Summer Palace with my senior. Suddenly I received an interview call from Renren.com. The person on the phone asked me various technical questions, and my answers were all "No." The other end was very nice and said it didn't matter. Finally, there was an interviewer on the other end of the phone, who spoke to me in Japanese and asked me what I had done. She was very satisfied with my answer. She was mainly satisfied because she found that my Japanese was very good. As a result, I became a bridge engineer at Renren.com. I remember that in the article I wrote earlier, in my personal profile, I said that I was criticized by netizens for my language talent. But when I was at Neusoft, everyone said that I had language talent, and I was used to thinking so. I just took it for granted. I am stating something, and I don’t mean to advertise it. I don’t know Python either, and I don’t even know what an open platform is. But I took over the maintenance of the entire open platform by myself because the boss of the open platform left for Meituan. By the way, this boss is really a great guy. He came from Tsinghua University. He started a business, came to Renren, went to Meituan and became P4, and now he is starting his own business. One day, my boyfriend showed me a photo from the Tsinghua Alumni Association and asked me, "Is this person a former colleague of yours?" I said, "Yeah." He said: "The person sitting next to him is our boss." Well, it seems that my male idol has a lot of room for improvement.

I bite the bullet and maintain this open platform. Then the Bubble Fish game will be connected to a Japanese platform. This game is written in python. At that time, this game was very popular. The game company was very busy and had no time to connect it, so they paid us for help. We can only take the code and connect it ourselves. At that time, Renren liked to engage in internal entrepreneurship. We were an overseas business department and we were not making money. I made the connection, and the game party gave us a 100,000 connection fee, and the rest was the game share. I don’t know how much the income was. But this was the only profitable project for us at that time. Python is really easy to learn. I maintain the website during the day, and everyone comes to me. At night, I do the access, study python and access documents, and finish the payment access part in one week. The test environment can be charged. But there was a problem going online. When running the formal environment built by the operation and maintenance MM, something was wrong. Everyone went home in the evening, and I worked on the online environment there by myself. Later, I finally discovered that the version of one part of the installed tool was wrong, but I can’t remember the details. That happened 6 years ago. So I have done python, but I don’t know python.

There is a high wall between Java and C++, which is surrounded by dynamic memory allocation and garbage collection technology. People outside the wall want to enter, but people inside the wall want to get out. You can't be so casual in Java, that is, optimize the memory allocation parameters. Speaking of JVM parameter optimization, in fact, the most commonly used thing that everyone knows and doesn't take seriously is to set the initial maximum and minimum values ​​of the heap to the same value, so as to avoid heap Automatic expansion, adjusting the size of the new generation and the old generation of full gc caused by throughput reduction and delay. It is said that almost all gc operations of the JVM, including minor gc, must stop the world.

Finally, I would like to recommend a foreign website to everyone. Practical tools and tuning techniques are often introduced, focusing on analysis. Representative works include and

The above is the detailed content of The road of Java architect--current limiting technology and various programming languages. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the reason why the video account live broadcast is not pushed? How to solve the current limitation? What is the reason why the video account live broadcast is not pushed? How to solve the current limitation? Mar 07, 2024 pm 02:04 PM

Beginning: With the rapid development of social media, live video has become one of the important ways for people to share their lives and convey information. However, sometimes when we use the live broadcast function of the video account, we may encounter a situation where the stream cannot be pushed. So what is the reason for this? 1. What is the reason why the live broadcast of the video account does not push the stream? Network problems are one of the main reasons why live video accounts do not push streams, especially unstable network connections. When the network signal is unstable, the video stream cannot be transmitted to the server smoothly, causing the live broadcast to be unable to be pushed normally. The instability of the network connection may cause freezes, interruptions or delays in the live broadcast, affecting the user's viewing experience. Therefore, a stable network connection is crucial for smooth live video streaming. To solve this problem, you can try to improve the network

The Stable Diffusion 3 paper is finally released, and the architectural details are revealed. Will it help to reproduce Sora? The Stable Diffusion 3 paper is finally released, and the architectural details are revealed. Will it help to reproduce Sora? Mar 06, 2024 pm 05:34 PM

StableDiffusion3’s paper is finally here! This model was released two weeks ago and uses the same DiT (DiffusionTransformer) architecture as Sora. It caused quite a stir once it was released. Compared with the previous version, the quality of the images generated by StableDiffusion3 has been significantly improved. It now supports multi-theme prompts, and the text writing effect has also been improved, and garbled characters no longer appear. StabilityAI pointed out that StableDiffusion3 is a series of models with parameter sizes ranging from 800M to 8B. This parameter range means that the model can be run directly on many portable devices, significantly reducing the use of AI

This article is enough for you to read about autonomous driving and trajectory prediction! This article is enough for you to read about autonomous driving and trajectory prediction! Feb 28, 2024 pm 07:20 PM

Trajectory prediction plays an important role in autonomous driving. Autonomous driving trajectory prediction refers to predicting the future driving trajectory of the vehicle by analyzing various data during the vehicle's driving process. As the core module of autonomous driving, the quality of trajectory prediction is crucial to downstream planning control. The trajectory prediction task has a rich technology stack and requires familiarity with autonomous driving dynamic/static perception, high-precision maps, lane lines, neural network architecture (CNN&GNN&Transformer) skills, etc. It is very difficult to get started! Many fans hope to get started with trajectory prediction as soon as possible and avoid pitfalls. Today I will take stock of some common problems and introductory learning methods for trajectory prediction! Introductory related knowledge 1. Are the preview papers in order? A: Look at the survey first, p

What should I do if my Douyin live broadcast has no traffic? The reason why the live broadcast room is restricted What should I do if my Douyin live broadcast has no traffic? The reason why the live broadcast room is restricted Mar 27, 2024 pm 10:51 PM

With the development of the Internet, live streaming has become a new marketing method in the e-commerce industry. Among many live broadcast platforms, Douyin Live has attracted much attention due to its large user base and powerful social communication effect. However, when carrying out Douyin live broadcasts to bring goods, some anchors face an embarrassing problem: there is no traffic in the live broadcast room and no one cares about the goods. So, when Douyin’s live broadcast has no traffic, how should we solve this problem? 1. What should I do if the Douyin live broadcast has no traffic? Improve content quality: The content of the live broadcast room is the key to attracting users. Anchors can start with product introductions, brand stories, interactive links, etc. to improve the quality and attractiveness of live content and make users want to buy. To reach a wider audience and meet their needs and interests, through direct

What is the architecture and working principle of Spring Data JPA? What is the architecture and working principle of Spring Data JPA? Apr 17, 2024 pm 02:48 PM

SpringDataJPA is based on the JPA architecture and interacts with the database through mapping, ORM and transaction management. Its repository provides CRUD operations, and derived queries simplify database access. Additionally, it uses lazy loading to only retrieve data when necessary, thus improving performance.

DualBEV: significantly surpassing BEVFormer and BEVDet4D, open the book! DualBEV: significantly surpassing BEVFormer and BEVDet4D, open the book! Mar 21, 2024 pm 05:21 PM

This paper explores the problem of accurately detecting objects from different viewing angles (such as perspective and bird's-eye view) in autonomous driving, especially how to effectively transform features from perspective (PV) to bird's-eye view (BEV) space. Transformation is implemented via the Visual Transformation (VT) module. Existing methods are broadly divided into two strategies: 2D to 3D and 3D to 2D conversion. 2D-to-3D methods improve dense 2D features by predicting depth probabilities, but the inherent uncertainty of depth predictions, especially in distant regions, may introduce inaccuracies. While 3D to 2D methods usually use 3D queries to sample 2D features and learn the attention weights of the correspondence between 3D and 2D features through a Transformer, which increases the computational and deployment time.

How to maintain an account if Douyin has limited traffic? What skills is needed to maintain an account? How to maintain an account if Douyin has limited traffic? What skills is needed to maintain an account? Mar 21, 2024 pm 09:10 PM

As one of the most popular short video platforms in the world, Douyin has attracted countless users to share their lives, talents and creativity here. As the number of users increases, competition on Douyin becomes increasingly fierce. Some users may encounter Douyin's streaming limitations, which may affect their video playback, likes, and fan growth. This article will discuss how to maintain a Douyin account after the current limit, as well as the skills that need to be mastered to maintain a Douyin account. 1. How to maintain an account when TikTok is restricted? If you find that your Douyin account has been restricted, you can take the following measures to maintain your account: Review video content: Carefully check recently posted videos to ensure they meet Douyin’s recommendation standards. If any illegal, vulgar or repetitive content is found, it will be deleted immediately. 2. Improve content quality: When creating videos, pay attention to content quality

1.3ms takes 1.3ms! Tsinghua's latest open source mobile neural network architecture RepViT 1.3ms takes 1.3ms! Tsinghua's latest open source mobile neural network architecture RepViT Mar 11, 2024 pm 12:07 PM

Paper address: https://arxiv.org/abs/2307.09283 Code address: https://github.com/THU-MIG/RepViTRepViT performs well in the mobile ViT architecture and shows significant advantages. Next, we explore the contributions of this study. It is mentioned in the article that lightweight ViTs generally perform better than lightweight CNNs on visual tasks, mainly due to their multi-head self-attention module (MSHA) that allows the model to learn global representations. However, the architectural differences between lightweight ViTs and lightweight CNNs have not been fully studied. In this study, the authors integrated lightweight ViTs into the effective

See all articles