Previous:Too rolled, a company has completely open source the core system (smart system) that it has operated for many years….
Hello everyone, I’m a top architect.
Recently, I made a microservices architecture project with Spring Cloud Alibaba, and I encountered a problem when deploying: there was not enough memory. At present, the project has 7 microservices, because I only have one Alibaba Cloud server (2C 4G), so I can only deploy all the microservices on one server, the deployment method is to use docker to make a springboot fat jar image, each microservice without adding any JVM tuning parameters without adding any JVM tuning parameters occupies about 500M of memory.
Because it is a microservice, it must be deployed: nacos, in addition to the use of reddis, sentinel, rocketmq, elk, etc. (mysql bought by Alibaba Cloud), just running these applications will occupy 2 more than G of memory, the remaining 1 multi-G memory is full after deploying 4 microservices, so the memory of the springboot application began to be initially optimized:
Add JVM parameters to optimize memory size
When the default free heap memory is less than 40%, the JVM increases the heap up to the maximum limit of -Xmx; When the free heap memory is greater than 70%, the JVM reduces the minimum limit for the heap up to -Xms.
Therefore, the server generally sets -Xms, -Xmx, and so on to avoid resizing the heap after each GC. The heap memory for an object is reclaimed by an automatic memory management system called the garbage collector.
By default, when the number of CPUs is less than 8, the value of ParallelGCThreads is equal to the number of CPUs, and my server is 2C, so this parameter can be omitted. After the configuration is completed, the startup service finds that the memory has indeed become smaller, from the original 500M to 100~200M, but it is not the effect I want, the effect I expect is to reach the level of tens of M.
After consulting a lot of information on the Internet, I learned that I could use Spring Native as a new technology to achieve my needs. (The technology is in a rapid iteration phase, with large changes, recommended for individual learning, not for production)
After the SpringBoot project uses Spring Native:
In short, to improve Java’s cloud-native competitiveness (personal understanding).
The following is an excerpt from Spring Native’s readme file on GitHub:
Spring Native provides beta support for compiling Spring applications into native executables using the GraalVM native image compiler to provide native deployment options typically designed to be packaged in lightweight containers. In fact, the goal is to support the nearly unchanged Spring Boot application on this new platform.
The following is an excerpt from other blogs:
In recent years, the term “native” has been flooded in cloud computing, edge computing and other fields, and the native favorite language has always been Golang, Rust and other development languages that are not running from Sandbox. Java has benefited from the popular compilation of the last century, the concept of execution everywhere, popular to this day, but also because of this reason, Java programs can not be separated from the JVM running environment, making it less favored by native programs. In today’s cloud-native world, the bloated JVM makes Java applications incomparably larger than other languages, and various gods have thought of many ways to make Java more “native”.
The environmental information related to this practice is as follows:
From the official documentation (above)
Applications that use Spring Native should be compiled using Java 11 or Java 17.
There are two main ways to build a Spring Boot-native application:
After going through various stepping pits, Method 1 and Method 2 were successfully used on this machine. In simple terms:
Method 1 is that after SpringBoot 2.3, you can use the spring-boot-maven-plugin plugin to build a docker image, use mvn spring-boot:build-image command combined with Docker’s API to implement the construction of Spring Bot native application, after successful execution, it will directly generate a docker image, and then run this image can be. Instead of writing Dockerfile, the relevant parameter configurations are configured in the pom .xml (the plugin’s configuration tag is very similar to fabric8 or spotify’s docker-maven-plugin).
Method 2 does not need to install docker, but to install Visual Studio, then execute the mvn -Pnative package command will generate an executable file (.exe), just run.
The main differences are as follows
Because each microservice uses Docker deployments instead of exe files, Method 1 fits my needs, so later in this article uses Spring Boot Buildpacks to build Spring Boot-native applications.
Official download address:
For method 1, the above three diagrams seem to only use the configuration JAVA_HOME on the line, if you want to succeed once, it is recommended to match 3, and then you can test yourself.
Oh! N open source projects necessary for private work! Hurry up and collect
Verify that the installation was successful
Open the new cmd, enter the following command, and wait for the installation
This step I failed to execute, the solution is to manually download native-image from github, and then unzip and install
jar with WinRAR can also be decompressed, after decompression is as follows
Open cmd in the bin directory, enter the following command, and wait for the installation
The specific steps are omitted, and you can follow the official documents:
The preparation work is all ahead, and this step is the beginning of the point
Start by quickly creating a Spring Boot project, which I named spring-native
The full pom is as follows
This article describes the Spring Native 0.11.1 version, its corresponding Spring Boot version must be 2.6.2, the above is just the most basic configuration case, the actual development also needs to be configured in the spring-boot-maven-plugin plugin configuration tag under the configuration tag of many other parameters.
For example, docker remote address and certificate path, jvm tuning parameters, configuration file designation, docker image name port warehouse address, etc., the best way is to see the official documentation of spring-boot-maven-plugin, here to configure jvm parameters as an example
The official documentation tells you that you only need to configure it under the configuration tab, for example
There are many other configuration parameters.
After downloading the relevant dependencies, the computer fan began to whirr around, and the task manager found that the CPU utilization was 100%, the memory usage soared, and finally stabilized at 90%+.
View all images
Spring-native is the image of the build
Create and run the container
Check the logs in Docker Desktop and find that the app started successfully, but it only takes time to start. That’s 59ms, which really confirms that Spring Native startup is millisecond level.
The interface was called successfully
In Docker Desktop to see the memory occupancy, only about 28M.
Don’t use Spring Native to launch apps
It takes 3s to start, occupying up to 511M of memory.
The article is for reference only, and it is recommended to study in conjunction with the latest official documents of Spring Native.
There are more high-quality project system learning resources in GitHub, welcome to share them with other students!
Everyone is welcome to discuss and collide their views and express their own views. If you have questions, you can also talk to me and communicate. Extension: Take on private work
Finally, I sorted out a copy of the BAT big factory interview real questions, and the required scannable code reply to the “interview questions” can be obtained.
“Top Architects” has established a reader architect exchange group, and everyone can add a small WeChat to add a group. Welcome friends who have ideas and are willing to share ideas to exchange and learn together.
Scan to add friends to invite you to the architect group, add me when you indicate [name + company + position]
Copyright notice: The content comes from the network, and the copyright belongs to the original author. If there is any infringement, please let us know, we will delete it immediately and apologize. Thank you.
Guess you still want to see it
Recommend an open source common background management system (with source code)
Look at people’s IM instant messaging system, that’s called an elegant (with source code)
Interviewer: If the order is not paid within 30 minutes, it will be automatically canceled, how to achieve it?
Alibaba technical expert: Yiwen teaches you to draw a technical architecture diagram efficiently
Awesome! Receive N system items necessary for private work! Hurry up and collect it (with source code collection issue 3)!
A rapid development modular scaffolding, saving you time and cost in development!
Several common JVM tuning scenarios (recommended collection)
How hard is it to make a nucleic acid system that doesn’t collapse?
Slow query MySQL positioning optimization trick, optimized from 10s to 300ms
Nginx+SpringBoott for load balancing
9 ways to get the /resources directory resource file, and who wouldn’t?!
Interviewer: How to design the sub-database sub-table of Meituan Takeaway?
Collection: Popularize the working principle of computers
12 thoughts on “Do this optimization and implement a SpringBoot project to start in 0.059s!”
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.. Putlocker
What a thrilling post, you have pointed out some excellent points, I as well believe this is a superb website. I have planned to visit it again and again. 123Movies
i really like this article please keep it up. 123Movies
It is included in my habit that I often visit blogs in my free time, so after landing on your blog. I have thoroughly impressed with it and decided to take out some precious time to visit it again and again. Thanks.
Top site ,.. amazaing post ! Just keep the work on !
Thank you for your good blog as always.Have a great day today.
Another thing I’ve really noticed is that often for many people, below-average credit is the reaction of circumstances beyond their control. For example they may be actually saddled by having an illness and as a consequence they have large bills for collections. It could be due to a occupation loss or even the inability to do the job. Sometimes divorce can send the financial situation in the wrong direction. Thanks for sharing your opinions on this weblog.
Hi there! I just wanted to ask if you ever have any issues with hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no back up. Do you have any solutions to prevent hackers?
Best Shop Front Shutters is an important question to ask when considering what type of shutter material to use for your shop front. There are a few options available on the market, each with its own advantages and disadvantages.
Whether you believe in God or not, this is a must-read message!!!
Throughout time, we can see how we have been slowly conditioned to come to this point where we are on the verge of a cashless society. Did you know that the Bible foretold of this event almost 2,000 years ago?
In Revelation 13:16-18, we read,
“He (the false prophet who decieves many by his miracles) causes all, both small and great, rich and poor, free and slave, to receive a mark on their right hand or on their foreheads, and that no one may buy or sell except one who has the mark or the name of the beast, or the number of his name.
Here is wisdom. Let him who has understanding calculate the number of the beast, for it is the number of a man: His number is 666.”
Referring to the last generation, this could only be speaking of a cashless society. Why? Revelation 13:17 tells us that we cannot buy or sell unless we receive the mark of the beast. If physical money was still in use, we could buy or sell with one another without receiving the mark. This would contradict scripture that states we need the mark to buy or sell!
These verses could not be referring to something purely spiritual as scripture references two physical locations (our right hand or forehead) stating the mark will be on one “OR” the other. If this mark was purely spiritual, it would indicate only in one place.
This is where it really starts to come together. It is shocking how accurate the Bible is concerning the implatnable RFID microchip. These are notes from a man named Carl Sanders who worked with a team of engineers to help develop this RFID chip
“Carl Sanders sat in seventeen New World Order meetings with heads-of-state officials such as Henry Kissinger and Bob Gates of the C.I.A. to discuss plans on how to bring about this one-world system. The government commissioned Carl Sanders to design a microchip for identifying and controlling the peoples of the world—a microchip that could be inserted under the skin with a hypodermic needle (a quick, convenient method that would be gradually accepted by society).
Carl Sanders, with a team of engineers behind him, with U.S. grant monies supplied by tax dollars, took on this project and designed a microchip that is powered by a lithium battery, rechargeable through the temperature changes in our skin. Without the knowledge of the Bible (Brother Sanders was not a Christian at the time), these engineers spent one-and-a-half-million dollars doing research on the best and most convenient place to have the microchip inserted.
Guess what? These researchers found that the forehead and the back of the hand (the two places the Bible says the mark will go) are not just the most convenient places, but are also the only viable places for rapid, consistent temperature changes in the skin to recharge the lithium battery. The microchip is approximately seven millimeters in length, .75 millimeters in diameter, about the size of a grain of rice. It is capable of storing pages upon pages of information about you. All your general history, work history, crime record, health history, and financial data can be stored on this chip.
Brother Sanders believes that this microchip, which he regretfully helped design, is the “mark” spoken about in Revelation 13:16–18. The original Greek word for “mark” is “charagma,” which means a “scratch or etching.” It is also interesting to note that the number 666 is actually a word in the original Greek. The word is “chi xi stigma,” with the last part, “stigma,” also meaning “to stick or prick.” Carl believes this is referring to a hypodermic needle when they poke into the skin to inject the microchip.”
Mr. Sanders asked a doctor what would happen if the lithium contained within the RFID microchip leaked into the body. The doctor replied by saying a terrible sore would appear in that location. This is what the book of Revelation says:
“And the first (angel) went, and poured out his vial on the earth; and there fell a noisome and grievous sore on the men which had the mark of the beast, and on them which worshipped his image” (Revelation 16:2).
You can read more about it here–and to also understand the mystery behind the number 666: https://2ruth.org/rfid-mark-of-the-beast-666-revealed/
The third angel’s warning in Revelation 14:9-11 states,
“Then a third angel followed them, saying with a loud voice, ‘If anyone worships the beast and his image, and receives his mark on his forehead or on his hand, he himself shall also drink of the wine of the wrath of God, which is poured out full strength into the cup of His indignation. He shall be tormented with fire and brimstone in the presence of the holy angels and in the presence of the Lamb. And the smoke of their torment ascends forever and ever; and they have no rest day or night, who worship the beast and his image, and whoever receives the mark of his name.'”
Who is Barack Obama, and why is he still in the public scene?
So what’s in the name? The meaning of someone’s name can say a lot about a person. God throughout history has given names to people that have a specific meaning tied to their lives. How about the name Barack Obama? Let us take a look at what may be hiding beneath the surface.
Jesus says in Luke 10:18, “…I saw Satan fall like lightning from heaven.”
The Hebrew Strongs word (H1299) for “lightning”: “bârâq” (baw-rawk)
In Isaiah chapter 14, verse 14, we read about Lucifer (Satan) saying in his heart:
“I will ascend above the heights of the clouds, I will be like the Most High.”
In the verses in Isaiah that refer directly to Lucifer, several times it mentions him falling from the heights or the heavens. The Hebrew word for the heights or heavens used here is Hebrew Strongs 1116: “bamah”–Pronounced (bam-maw’)
In Hebrew, the letter “Waw” or “Vav” is often transliterated as a “U” or “O,” and it is primarily used as a conjunction to join concepts together. So to join in Hebrew poetry the concept of lightning (Baraq) and a high place like heaven or the heights of heaven (Bam-Maw), the letter “U” or “O” would be used. So, Baraq “O” Bam-Maw or Baraq “U” Bam-Maw in Hebrew poetry similar to the style written in Isaiah, would translate literally to “Lightning from the heights.” The word “Satan” in Hebrew is a direct translation, therefore “Satan.”
So when Jesus told His disciples in Luke 10:18 that He beheld Satan fall like lightning from heaven, if this were to be spoken by a Jewish Rabbi today influenced by the poetry in the book of Isaiah, he would say these words in Hebrew–the words of Jesus in Luke 10:18 as, And I saw Satan as Baraq O Bam-Maw.
The names of both of Obama’s daughters are Malia and Natasha. If we were to write those names backward (the devil does things in reverse) we would get “ailam ahsatan”. Now if we remove the letters that spell “Alah” (Allah being the false god of Islam), we get “I am Satan”. Coincidence? I don’t think so.
Obama’s campaign logo when he ran in 2008 was a sun over the horizon in the west, with the landscape as the flag of the United States. In Islam, they have their own messiah that they are waiting for called the 12th Imam, or the Mahdi (the Antichrist of the Bible), and one prophecy concerning this man’s appearance is the sun rising in the west.
“Then I saw another angel flying in the midst of heaven, having the everlasting gospel to preach to those who dwell on the earth—to every nation, tribe, tongue, and people— saying with a loud voice, ‘Fear God and give glory to Him, for the hour of His judgment has come; and worship Him who made heaven and earth, the sea and springs of water.'” (Revelation 14:6-7)
Why have the word’s of Jesus in His Gospel accounts regarding His death, burial, and resurrection, been translated into over 3,000 languages, and nothing comes close? The same God who formed the heavens and earth that draws all people to Him through His creation, likewise has sent His Word to the ends of the earth so that we may come to personally know Him to be saved in spirit and in truth through His Son Jesus Christ.
Jesus stands alone among the other religions that say to rightly weigh the scales of good and evil and to make sure you have done more good than bad in this life. Is this how we conduct ourselves justly in a court of law? Bearing the image of God, is this how we project this image into reality?
Our good works cannot save us. If we step before a judge, being guilty of a crime, the judge will not judge us by the good that we have done, but rather by the crimes we have committed. If we as fallen humanity, created in God’s image, pose this type of justice, how much more a perfect, righteous, and Holy God?
God has brought down His moral laws through the 10 commandments given to Moses at Mt. Siani. These laws were not given so we may be justified, but rather that we may see the need for a savior. They are the mirror of God’s character of what He has put in each and every one of us, with our conscious bearing witness that we know that it is wrong to steal, lie, dishonor our parents, murder, and so forth.
We can try and follow the moral laws of the 10 commandments, but we will never catch up to them to be justified before a Holy God. That same word of the law given to Moses became flesh about 2,000 years ago in the body of Jesus Christ. He came to be our justification by fulfilling the law, living a sinless perfect life that only God could fulfill.
The gap between us and the law can never be reconciled by our own merit, but the arm of Jesus is stretched out by the grace and mercy of God. And if we are to grab on, through faith in Him, He will pull us up being the one to justify us. As in the court of law, if someone steps in and pays our fine, even though we are guilty, the judge can do what is legal and just and let us go free. That is what Jesus did almost 2,000 years ago on the cross. It was a legal transaction being fulfilled in the spiritual realm by the shedding of His blood.
For God takes no pleasure in the death of the wicked (Ezekiel 18:23). This is why in Isaiah chapter 53, where it speaks of the coming Messiah and His soul being a sacrifice for our sins, why it says it pleased God to crush His only begotten Son.
This is because the wrath that we deserve was justified by being poured out upon His Son. If that wrath was poured out on us, we would all perish to hell forever. God created a way of escape by pouring it out on His Son whose soul could not be left in Hades but was raised and seated at the right hand of God in power.
So now when we put on the Lord Jesus Christ (Romans 13:14), God no longer sees the person who deserves His wrath, but rather the glorious image of His perfect Son dwelling in us, justifying us as if we received the wrath we deserve, making a way of escape from the curse of death–now being conformed into the image of the heavenly man in a new nature, and no longer in the image of the fallen man Adam.
Now what we must do is repent and put our trust and faith in the savior, confessing and forsaking our sins, and to receive His Holy Spirit that we may be born again (for Jesus says we must be born again to enter the Kingdom of God–John chapter 3). This is not just head knowledge of believing in Jesus, but rather receiving His words, taking them to heart, so that we may truly be transformed into the image of God. Where we no longer live to practice sin, but rather turn from our sins and practice righteousness through faith in Him in obedience to His Word by reading the Bible.
Our works cannot save us, but they can condemn us; it is not that we earn our way into everlasting life, but that we obey our Lord Jesus Christ:
“And having been perfected, He became the author of eternal salvation to all who obey Him.” (Hebrews 5:9)
“Now I saw a new heaven and a new earth, for the first heaven and the first earth had passed away. Also there was no more sea. Then I, John, saw the holy city, New Jerusalem, coming down out of heaven from God, prepared as a bride adorned for her husband. And I heard a loud voice from heaven saying, ‘Behold, the tabernacle of God is with men, and He will dwell with them, and they shall be His people. God Himself will be with them and be their God. And God will wipe away every tear from their eyes; there shall be no more death, nor sorrow, nor crying. There shall be no more pain, for the former things have passed away.’
Then He who sat on the throne said, ‘Behold, I make all things new.’ And He said to me, ‘Write, for these words are true and faithful.’
And He said to me, ‘It is done! I am the Alpha and the Omega, the Beginning and the End. I will give of the fountain of the water of life freely to him who thirsts. He who overcomes shall inherit all things, and I will be his God and he shall be My son. But the cowardly, unbelieving, abominable, murderers, sexually immoral, sorcerers, idolaters, and all liars shall have their part in the lake which burns with fire and brimstone, which is the second death.'” (Revelation 21:1-8).
There are many reasons why you might want to replace your shopfront windows. Maybe your current windows are drafty and energy inefficient, or maybe you want to let in more natural light. Or, perhaps you’re simply looking for a way to improve the curb appeal of your property.
We are a bunch of volunteers and starting a new scheme in our community. Your website offered us with helpful info to paintings on. You’ve performed a formidable process and our whole community might be grateful to you.