Home  >  Article  >  Java  >  Introduction to java backend

Introduction to java backend

angryTom
angryTomforward
2019-08-03 16:42:253962browse

Introduction to java backend

Novice programmers usually fall into the misunderstanding that just by learning a language, they can be called a certain language engineer. But is this really the case? This is not the case.

Today we will talk about what exactly Java development engineers develop. To be precise, what exactly is the Java backend doing?

Everyone knows that Java is a back-end language. The back-end refers to the server. The server-side code generally runs on the server. Usually the servers we run Java programs on are Linux servers.

These servers are generally placed in a place called a computer room in Internet companies, so the code of Java programmers like us generally runs on the servers in these computer rooms.

Introduction to java backend

There is a concept in Java called a virtual machine. You can think of it as an Android emulator. For example, if you install an Android emulator on your computer, you can It is used to run Android applications, such as installing an APP, mobile games, etc.

So when you install something called JDK on your computer, there is JRE, which is the Java runtime environment, on your computer. With this runtime environment, you can run Java applications.

After knowing how Java programs run on computers, let’s talk about some basic Java knowledge that we usually learn. What is their use?

In fact, these basic Java grammars are just some basic knowledge for you to write code, which is equivalent to 26 letters in English. Common ones include basic type variables, for loops, if else and other basic grammars. , after mastering these basic knowledge, you can start writing some very simple codes.

Introduction to java backend

In addition, Java also has some special concepts, such as object-oriented features, including concepts such as classes and interfaces. Why does Java introduce these things? It actually wants users to better design, abstract and program.

For novices, you don’t need to understand it very deeply, because you can only gradually understand these things after you actually write the code.

After talking about the basic knowledge, I think you will also be curious about what the collection classes often mentioned in Java are for, because there are many scenarios in real life that require the use of collection classes, such as Let's talk about a list of usernames. How do you save it?

You will use a List to do this, right? So the role of the collection class is to allow you to better store data in programming.

In fact, the concept of collection class originated from data structure, because there are many special data storage structures in computers, such as file trees, linked lists, arrays and other structures, so computer theory refers to these stored data The model is abstracted into some common structures, collectively called data structures.

So, what does concurrent programming in Java do? Multi-threading in Java is to make better use of the CPU core in the computer. Through concurrent programming, the efficiency of program concurrency can be improved.

But concurrent programming requires the support of the operating system and the support of computer hardware. Therefore, if you want to fully understand multi-threading, it is not enough to just understand Thread or thread pool in Java. , you also need to understand the operating system and the principles of computer composition.

Similar to concurrent programming, Java also has the concept of network programming. Network programming in Java is similar to other languages. In fact, it is also a set of APIs based on the TCP/IP protocol. Through network programming, you can In the program, transfer the data you want to transmit to the other end of the network. With network programming and concurrent programming, Java programmers are already very powerful.

Introduction to java backend

Finished After these points, let’s talk about what Java back-end technology we usually talk about is. Let’s take Alipay as an example. There were not many Alipay users in the past. One server and one database can support all businesses. .

When the number of Alipay users increased, one server could not meet the needs of a large number of users at the same time, so multiple servers began to appear. Multiple servers formed a cluster, and users could use load balancing to By accessing these servers, each user may access a different machine, thus achieving a diversion effect and reducing the pressure on the server.

Since the database needs to ensure the reliability of the data, if a certain database hangs up and there is no backup, then the data will be inaccessible. This is not allowed in large systems, so there is Master-slave deployment of the database.

But in fact, with the development of business, the pressure on the database is also increasing. The active and standby deployment cannot solve the problem of database access performance. Therefore, we need to divide the database into separate tables. In the active and standby database On the basis of , we will split a table with a large amount of data into multiple tables, and divert database requests to different data. For example, 100 sub-databases and 100 sub-tables are equivalent to dividing a data table into Divided into 10,000 data tables.

Another problem arises at this time. If a database has multiple standby databases, and master-slave switching is required when the primary database hangs up, the data between the primary and standby databases may be inconsistent, and this It is also one of the issues studied in distributed theory. Because it is relatively complicated, we will skip it here.

I just mentioned distributed technology. In fact, load balancing and sub-database and sub-table are all implementations of distributed technology. If you don’t want to do sub-database and sub-table, then what other ways can reduce database access? What about pressure? So the cache appeared. The cache allows the server to send the request to the cache first. Since the cached data is generally in the memory, the access speed will be very fast, and these requests do not need to go through the database.

Introduction to java backend

With the development of business, the pressure on single points of cache will be greater, so distributed cache appears. Generally speaking, cache cannot guarantee the reliability of data. , because their data may be lost, and the cache can only store part of the data and cannot solve all problems.

Therefore, when the request volume of certain businesses is very large, caching alone cannot solve the problem. At this time, we can also use message queues to help us solve the problem of large-traffic concurrent requests.

We can store part of the request messages through the message queue, and then gradually take out the messages based on our server's ability to process requests, and then process these messages gradually, so that it can be very good Solve the problem of high concurrency. Of course, the premise is that the message queue must ensure the reliability of message storage, which is also a capability that most message queues guarantee.

Having said so much in one breath, I have given a clear introduction to the general appearance of the Java backend. In addition, there are many things that have not been mentioned. If I really wanted to finish it, I would not be able to finish it in one night.

Generally speaking, Java back-end technology is neither difficult nor simple. I try to make these contents as easy to understand as possible. In fact, there are many complexities behind each technology. Implementation principle, of course, after you understand the overall concept of Java back-end technology, I believe it will be more helpful for your subsequent learning.

The above is the detailed content of Introduction to java backend. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete