📜 ⬆️ ⬇️

“The Java world will never be the same again” - an interview with Alexander Belokrylov and Alexey Voitylov from BellSoft

The last days remain before Joker, and I really wanted to bring on Habr not an ordinary interview, but some powerful game. Recently, people are interested in servers on Arm, and it so happened that we have real experts on this topic.

Alexander ( alexbel ) Belokrylov and Lesha Voytylov, together with Grigory Lubzovsky, who led the Oracle development center in St. Petersburg, founded BellSoft a little over a year ago. Now the company is successfully operating, developing and has already managed to gain fame in the Java-world.

By the volume of commits in OpenJDK over the past year, they came in fifth place, and now only Oracle, Red Hat, SAP and Google are ahead:
')


It should be understood that BellSoft is not only Arm:


In this interview we will touch only Arm, and leave the rest for the next time.

So, today in our virtual studio:

Alexander Belokrylov


Lesha Voytylov


Oleg Chirukhin - edited by JUG.ru Group




Tell us more about the company?


BellSoft company is engaged in several areas. Everyone probably knows that Oracle in St. Petersburg had a very serious low-level expertise in the development of Java Runtime, in the development of compilers, in the development of Oracle Cloud Services systems. And this expertise from Oracle migrated to BellSoft. Today, our company is developing Java Runtime, we are an active OpenJDK contributor, we are developing gcc and llvm compilers, contributing to the Apache, Graal stack. We are engaged in building systems for analyzing big data, recommender systems and have built a small project on IoT, for collecting data from devices from the real world. At some point, we saw that Oracle stopped releasing a Java distribution for Arm platforms, and we released our distribution, which we called Liberica JDK for Raspberry Pi. Since then, we have been successfully supporting it.



Let's take a closer look. What is, for example, an Apache stack?


We started contributing to the Apache Foundation with Hadoop - much is tied to certain parts of this project. OpenJDK and large Apache projects, though not directly, but strongly interrelated.




Why all this may be necessary? For example, some classes that inhibit them, you can overclock them?


Yes, this is one of the areas we are engaged in - improving productivity. For example, platform-specific parts, the acceleration of which in OpenJDK can help speed up Hadoop. If interested, we can talk about it.


When you solve problems with performance, it makes sense to look at something close. Maybe somewhere there is the same problem. Very often you see that having corrected in one place, you need to correct it in a couple more places so that in general it becomes better. Sometimes (and very often) performance optimizations are decomposed into contributions to several projects. If you want to improve, for example, checksum performance, you will look at the very bottom of the stack. Let's say this is java. If you look a little higher, it will be Hadoop, Spark or something else. Usually having understood how to improve one place, one can understand how to do it in another place. Of course, it makes sense in this case to go and improve there too.



Everyone knows that you are Liberica :-) Let's talk about this.


Yes, we are Liberica JDK. Liberica started with the fact that we saw that there is no port for the ARM32, and it urgently needs to be done, because the Raspberry Pi was left without Java 9 and Java 10. That was in 2017, when Java 9 was released. Now Liberica JDK supports many architectures and operating systems.


It became clear that Oracle was not going to further develop the code for Arm, and we began to actively contribute and release our distribution to close this gap. It became clear that people need it.




So, now there are several distros Arm?


Yes, there are several Java distributions for Arm, they are different. In our case, you actually get what used to be part of the Oracle port distribution. In our distribution, JavaFX, device input / output, and the API for the embedded are present. This is a kind of package, and it all works with modules, starting with JDK 9. Using a modular system, you can build Runtime as you wish. If you want, you can make a small Runtime of 16 megabytes. If you want to include more features, such as a web server, then you need to spend about 32 megabytes of static space. You can get a working runtime for your needs.



As far as I understood, it was about arm servers. Not to say that they have used us massively. Tell me about the server? In real life, are they anyway?


This story for many years. The very first Arm server was made based on the ARMv7 architecture, 32-bit. It was a terribly noisy box, which practically did not work, because the BIOS, Linux did not work there, anything else disappeared in a few hours. The company that started it, Calxeda, closed over time. But the idea of ​​developing an alternative architecture for servers has been sown into society. Arm eventually released a new ARMv8 architecture specification, which supports both 32 and 64 bits. Based on the 64-bit version of this specification, several manufacturers are now building their processor implementations for servers. For example, Ampere Computing, Cavium, which is now purchased by Marvell, and Qualcomm. And there is another company - AMD released a server based on the Arm-architecture a few years ago. In my opinion, they still continue to do this.



If you remove one letter L from Marvell, you get superheroes. A good way to remember the names of all these offices.


Superheroes are actually Cavium / Marvell, because of all of them, they managed to assemble the most productive chip up to 128 threads on a single CPU, and comparable or best in performance with Xeon Gold and Platinum. You can put several CPUs in one server, you get a monstrous thing with fast memory, which can be used for serious tasks.



How does the scaling limit grow for normal use? How much CPU does it make sense to stick into one server?


It all depends on what task you want to build a server for. Different manufacturers are guided by different niches, but if we are talking about Cavium / Marvell, they are clearly focused on computing niche, where you need to quickly chew a large amount of data in parallel. They do not focus on the super high performance of one thread (at the same time, it is very good), namely, that, in general, this CPU showed greater performance with low cost consumption.



Why Arm and not Intel? We have wonderful Intel servers, why invent something else?


This question is both difficult and easy to answer. First, the holy place is never empty. We see that AMD is trying to build some kind of alternative to Intel for server applications. And of course, there will always be some alternative piece of the market among alternative manufacturers.


No one wants to live with one monopolist.


Very true remark. All consumers of processors, and this is mainly Cloud providers, want to be able to alternatively. In order to be able to choose, compare costs with costs and for specific applications choose a more profitable architecture.




And what about the cost? How expensive is it than Intel solutions?


Complex issue. First, as Alexei said, manufacturers are enough. It is clear that now manufacturers Arm-processors do not compete with each other, and compete with someone else. Take a little different niche. If Cavium is high performance computing, then Qualcomm is mid-range servers, Ampere is either workstations or low-end servers.


If I remember correctly, the price of the Ampere Computing CPU itself is $ 600-900, and they compete with Intel, a CPU costing about $ 1,500. Cavium is a bit more expensive. Again, they will compete with Intel, which is significantly more expensive. You need to understand that the price of the server is not only the price of the CPU. The server price is also memory, disks, support, consumption. If you win by one parameter, for example, the cost of CPU - this is fine, but you will be only slightly cheaper. If you win in two ways, for example, being cheaper, and offer the best performance, they will look at you more closely. And if three, for example, also do all this with less electricity consumption, then this is already an application for victory.



In addition to hardware and its support, software support is also important. You can not run on Arm all that you have now spins on Intel.


Of course. It must be said that the Arm-ecosystem of software has advanced far ahead. If five years ago there were problems in order to raise a piece of metal, now there are no such problems. You just come, and everything works out of the box for you. Everything that you are used to works - Linux, Docker, Kubernetes, Xen, Java, Hadoop, Spark, Kafka, whatever.



What about java? Tell us how it works, how it differs from the “usual”?


No different, this is its main advantage. It is productive enough to cope with the tasks assigned to Java for servers. You transfer your application (I hope that it does not have a native part, otherwise you will have to recompile it), to the Arm server, check the performance and in most cases - rejoice. Recently an article appeared where we compare the performance of the Arm server with the Intel server . Article published in Java Magazine.



Did Oracle allow you to advertise in your own magazine? Seriously.


Apparently, there is a demand. It turns out that the Java Arm server for Java workloads do quite well. They are the same, or even better in comparison with their counterparts from Intel.



Who should read your article?


Anyone who wants to see, test a new architecture, whether it is suitable for its loads. Try Java and those Arm-servers. In Google, you drive in Arm Server Cloud, and you drop out several cloud providers, you can spend a card and try what you need.



Is Java preinstalled already?


Yes. Plain OpenJDK.



Is the regular OpenJDK and your Liberica distribution the same thing? I saw that your commits are there - is this it or something else?


In general, the history of Arm ports and OpenJDK is quite interesting and ornate. Oracle initially developed the Arm port and, when Arm released the ARMv8 architecture, an additional port was added to this Arm port, which allowed Java to run on ARMv8. Parallel to this, Red Hat also worked in this direction and in OpenJDK poured in its port for this architecture. It so happened that the community focused on the port of Red Hat. Therefore, the one side that was in OpenJDK for the ARM32 port, which actually duplicated the functionality of the aarch64 port, is now done. We will remove it from the JDK 12 by a good will. For this, there is a JEP 340.


It must be said that Oracle poured into OpenJDK all of its work from embedded, all Arm ports before discontinuing support. Now all features for Arm which became in Oracle are poured.


This is logical, because it is iron manufacturers and manufacturers of specifications that should first of all be interested in the software ecosystem working on their hardware and compatible with their specifications. To do this, the code must be open.



I saw an infographic on which amazing numbers were drawn that a certain BellSoft company, located in St. Petersburg, had flooded a huge number of commits.


Yes, we are in the top 5 OpenJDK committers. Naturally, Oracle is out of competition, there are about 4 thousand commits per year.


Next comes Red Hat, SAP, Google and BellSoft. We have not reached Google a little bit. And right behind us is IBM.



What percentage of your employees used to work in Oracle?


100 percent. BellSoft consists of former Oracle employees.



This is unfair competition, because Google does not consist of 100 percent of Oracle employees. What commits tell? How to achieve such a success? How to get to the top 5 committers?


We work in several directions. Now the main direction where our commits go is the ARM64 port, which is the same server port. It is interesting to iron producers. They are interested in Java to work quickly on their hardware, to cope with the loads. The second, where commit, is the port ARM32, which is supported by us, it is an embedded-port. The third is commits to support, fix, and improve the overall functionality of Java.



We just talked about 64 bits on the servers. Why is the 32-bit port still alive?


Because it is used in embedded.


Because so many companies have implemented a CPU for the ARMv7 architecture for embedded applications. They have a large number of chips in stock. If my memory serves me, of the variety of these ARM32 chips, the most popular is ARMv5. This architecture has been around for many years, but nevertheless, the CPUs are quite cheap, and manufacturers are still considering the creation of new devices on this architecture.



What amounts are we talking about when we are talking about building? Can an ordinary person buy something and experiment?


The most popular of the ARM32 platform is the Raspberry Pi, starting with the second version - the second and third versions, plus all this is supported by the ARM32 port. One of our distributions is one that, for ARM32, is tested and works on Raspberry Pi. We see that this is the most common platform for a wide audience, and therefore we are releasing the port specifically for the Raspberry Pi. We have more specific ports for highly specialized hardware, but that’s another story.


Maybe you do not need to buy. You can see what you have in your home router. It is very likely that there is something like that.



How much should the developer's skills match?


You need to be a Java developer.



Do we need tricky ways, Kirchhoff's law to know to code?


You just have a computer to which you can connect via SSH. No ability to flash it is necessary. You take a Linux MicroSD card for the Raspberry Pi, insert it, and everything starts. This is the main advantage of Raspberry Pi compared to all other single board computers. Easy to set up, get a working system.



And how to work with the sensors? We do all this for the sake of external systems, right?


The Raspberry Pi has a GPIO system and pins to which you can connect anything. On which all enthusiasts usually have all the peripherals to the Raspberry Pi and connect.



How does the API look like? What do you need to write, like, “get me a number from the thermostat”?


You need to read the thermostat datasheet, and understand what registers are, how to initialize it, how to configure it. If I2C, call the method for configuration, pass all parameters to it. Then tell him i2c.open, and work with it as a Java object.



Is it possible to write beautiful object wrappers around thermostats in order to work in a purely object model? Can I do this in order not to read more datasheets, to close it with a facade?


It would be nice if the manufacturer of this sensor made a ready-made config, and we, as Java programmers, simply took it and used it. The library works with one sensor, a library for working with another sensor. Such a library, or something close to it, is called Pi4J. It is developing now not as rapidly as at the time when Oracle moved Java embedded, but it still did not die, some updates periodically come out. Here there is a choice: either to work with the thing that in OpenJDK is GPIO, or to work with the Pi4J library.



If I’m a hardware manufacturer, I don’t know anything about Java, but I would like Java programmers to use it, who to contact? To contact you? Or are there experts who do this?


Yes, we are such specialists.



So far we have not fled. I remember that you had some kind of JEP, yes?


OpenJDK version 11 includes 17 JEP. 14 was done by Oracle, 1 by Google, 1 by Red Hat, 1 by BellSoft with Cavium. Our JEP is a hodgepodge of performance improvements in Java on the ARM64 platform for specific workloads. JEP, respectively, is called the Improve Aarch64 Intrinsics . In short, we have improved the performance of operations with String, with arrays and a bit with math and trigonometry.



What is intrinsiki? Not everyone knows.


When a virtual machine considers a sine, instead of executing direct Java code, it can substitute an optimized assembler box for a particular architecture.



Which directly calls the processor, which has the command "sine"?


Which will calculate it by a complex algorithm. There are intrinsiki that cause some kind of assembly command. For example, intrinsiki associated with computing cheksumm. Such assembly instructions are available for almost all architectures. There are more complex intrinsiki when to write a lot of assembly language to get a good performance boost.



And encryption, is it in the gland?


Yes, usually it is a call to existing instructions of a particular processor. Sometimes - work with extensions on those chips where they are.



Coming back to your JEP: how to determine which code is so hot that it is worth it so hard?

Great question. When we started to optimize something for the ARM64 platform, we did not have a large number of bodies, besides perf. Yes, and he did not work everywhere. JFR implementation for ARM64-port was missing, Oracle by that time had not yet laid out in Open Source. Different tools for measuring performance, which we used to use, for example, async-profiler, honest-profiler - they did not work for ARM64 platforms either. The first thing we did was get all these tools on this architecture.



Why not work out of the box?


Because there is some kind of CPU-specific part.

Then you run these tools on the workload you are trying to optimize, look at the screen for a long time, try to figure out which methods are hot there, which places are hot. There are simple cases when some assembly inserts for a specific architecture are not implemented. In this case, a fallback occurs in the Java code. Just by implementing these assembler inserts you can get an increase in performance. There are more complicated places when you need to understand what kind of new assembly insertion you need to create in Java for all architectures. Such a job.



Where from to take? Download the entire githab and run under JIT?


It is clear that some benchmarks or workloads are being optimized. Known benchmarks - SpecJBB, SpecJVM. There are specific workloads that interest specific customers. Just run these workloads and look at the bottlenecks.



All these SpecJVM are very old tests, right? What about new lambdas, streams, big dates?


Nothing. There is no it.



And where to get it?


New workloads.



For example, the Apache stack?


Yes. Hadoop TeraSort, . .



, ? , JEP.


, , . , , , . , , . , , . Panama, Intel.



, ? , , - ?


Math.sin , Java- sin .



- , sin ?


Yes. , .



- , , ?


C2, .



- . , ?


.


, Linaro Connect OpenJDK ARM64. Linaro Foundation Arm-.



?


Arm, . .



?


. . Joker, .



!


, . floating point. , , , . — , . , , — . , .



. , , ?


Yes. Arm … , — . , . - - , — . , , . , , . , Java- , .



, - , . ?


OpenJDK BellSoft.



, , ? ? Oracle, . JVM-?


, OpenJDK. ()



, 250 . ?


, 250 . .



— ? .


, . . , — . - .



, ?


.



?


. . , - , , . , , , . - . , . , , . , OpenJDK .



?


Mailing list. - mailing list, .



-?


Jira. OpenJDK Jira, , , .



Jira Jira, , ?


OpenJDK . , Jira.



? , , , , , Arm?


Arm, , , . shared-, , . , . .



, . , .


, . HotSpot, , , . , , - — .



- ?


Yes. HotSpot tiers. smoke- . , , . , performance-, stress-.



. , , JDK, . JDK, . , ?


JDK, , JVM. JVM 4 : runtime, serviceability, garbage collector, compiler. - . , runtime. - out of order execution, , GC . , JIT, . community OpenJDK — JIT.



, , ?


, . , . . . , -, , .



? ? ? , , - ?


. , .



, , - , . .


. , OpenJDK Arm. , , IT. -, , Arm . , Arm, Arm , . , OpenJDK, Arm. , , . Arm Intel SPEC-. , . . !


, ?



, ?


, .


. . , ARM64? . , Arm .


.



— , , -, . ? - , Arm?


, .



?


Arm . . , , ? . .


, . , , , . - 10 , GPU - , . Cloud- . , , -. GPU, CPU. -, HTTP 404. , . , .



, - , ? - ?


. , . 30 ? . , . - , , . : 20% , 20%, — 10%, - . , Arm .



, Java, , . , , .


Arm , BellSoft — Arm, . OpenJDK, - . Liberica Liberica Arm 32 64, Liberica Linux (64 ), Windows Liberica Mac. Liberica Solaris Sparc. .



Liberica Mac? -.


? Oracle , … . ?



?


, Oracle. , Java- .



Java- .


, . , .



.


Yes. -, support . - — , , Cloud-. , , - , .



, Oracle JDK , API. -XX:+UnlockCommercialFeatures . , . , Oracle , .


, Oracle - Oracle, . . Java , .


, , OpenJDK . . BellSoft , , .



, , . . , , OpenJDK — .


!



. , — . - ?


. , , , . .


- OpenJDK.



. ?


Liberica, . Raspberi Pi, Linux-. , Java, -.



Joker, , BellSoft — .


. , , . , :-) Joker — .



, . !



. Joker 2018 «, ARM? , » . .

Source: https://habr.com/ru/post/426565/


All Articles