What Joker is silent about. Conference story

    On October 15, the glorious city of St. Petersburg was visited by the supervillain of the Joker Universe.
    No, he didn’t kill anyone, and not one Batman was injured. But his visit, however, will be remembered by many. Firstly, it was the premiere of a new conference on Java technologies. Secondly, this conference was a success, which means that it has a great future, and the first conference is always history.

    image

    A pleasant surprise


    I spoke at the conference as a speaker: the organizers contacted me two months before and offered to speak, which was a pleasant surprise. It was organized by the leaders of the St. Petersburg JUG - Alexey Fedorov (@ 23derevo), Andrey Dmitriev (@real_ales) and Ivan Dolgov (@jetliner) (and many more who helped). At one of the afterparties, Aleksey told how the idea of ​​the name of the conference came to him: “I listened,” he says, “to Prokofiev’s Mariinsky Love for Three Oranges, and then could not sleep for a long time. Different characters were spinning in her head: king of spades, king of clubs, buffoon. And the deadline for the concept of the new conference was already on the nose. So the idea arose to somehow beat the topic with playing cards. Well, since Java conferences are usually called somehow by the letter J, the word Joker came by itself somehow. ”

    And all the more surprising that in two months the guys managed to make a very decent program, working with all speakers individually, making runs and helping in every way. But there were some oddities in the program: the three names of the reports began with “What is silent about ...”.
    How it happened, this story is silent.

    Residence


    Two people from our company Excelsior spoke at the conference: me and Pavel Pavlov (@noinline). A conference was held on Vasilievsky Island, in the Pribaltiyskaya Hotel. Leaving the metro, we decided to walk to the hotel - it seemed to us a good idea to walk around the night Peter. But after passing 10 meters, we suddenly found ourselves in the city of Novosibirsk: painfully familiar Soviet buildings and the weather exactly the same as in Novosibirsk. “3rd Street Builders,” in short.

    Almost all the visiting speakers and organizers lived in the same hotel, and since the conference was also held in the hotel, it was possible to go to reports in slippers. And it was a miracle of some kind, the first time I came across this: you wake up in the morning, go to breakfast, meet a bunch of familiar people, talk until you start to kick them out for lunch, then go up to the second floor - and here’s the conference, then the after party, and then you return to the hotel, and there is an after-party. In short, I talked about programming topics like never before in my life, I’m even tired of it at the end!

    Conference


    And rising to the second floor, I was at a conference. Having met the organizers with puffy eyes, I immediately realized who the “heroes of our time” are today: it was possible to guess without a doubt that the team had hardly slept for the past few days.
    The opening of the conference was almost unnoticed, Lyosha Fedorov said where are the halls by card suits - one must maintain the style), which everyone dispersed in. In the corridor one could take pictures with the Joker (see photo above) and play ancient computer games.



    “How I created a Java desktop application downloaded 9,000,000 times”


    I went to the report of Anton Keks (@antonkeks), the author of the sensational JUG.ru report “ How can we save Java .” Anton is engaged in the main work “bloody enterprise” (the term that I picked up at this conference), and in my free time makes a popular desktop application for wiretapping the “Angry IP scan” grid, which Anton originally wrote in C and then rewrote in Java, which he is very happy about.



    The report began with a small fakap: all reports came from the organizers' computers and Java was not installed on these computers ! As a result, Anton could not show his APPENDIX in action. This fact once again convinced me that, if you are doing desktop applications in Java, you can not rely on the fact that the end-user, this Java stands (on how to solve this problem, was my report“Java is losing weight” at JavaOne in Moscow ). But, unfortunately, this did not convince Anton.

    The whole report, Anton tried to convey to people a simple idea what to do on Java desktop applications is possible and necessary! With which I completely agree, I am still genuinely surprised by the fact why Java on the desktop is not very popular, especially with the growing popularity of Mac and Ubuntu. The latter fact prompted Anton to rewrite the application from C and the Win API to Java, simply because he himself has not used Windows for a long time, but he does not want to lose Windows users.

    As a UI for Java, Anton promoted SWT. If anyone does not know, this is the UI library from IBM on the basis of which the Eclipse UI is made. The joke of this library is that applications written in SWT always look like native applications of the target platform, simply because they use native controls to draw the UI. What is wrong with the default UI for Java is Swing, where the UI of the target platform is emulated (and not always good). General War Swing vs. SWTs were quite popular in the early 2000s. My personal position on this is that both UIs are good, and if on SWT you always get the native UI of the target platform, then on Swing you can do a better UI than the native one and an example of this is IntelliJ IDEA (I don’t think Windows is so draws buttons well). And in light of the last statement, I also do not consider the choice of JavaFX bad.

    Anton also talked about HIG - human interface guidelines. The idea of ​​this thing is that on different platforms there are rules for arranging / naming controls, and it is better to follow these rules so that the end user gets the familiar experience when working with your application. And thus, the HIG rules for a particular platform must be considered when writing the UI. Yes, there will be a little platform-dependent code, but with different tricks (such as a layout manager), according to Anton, you can make the amount of this code very small.

    After the report, Anton and I talked for another 20 minutes in the corridor: I am very glad to meet him, and probably for me he is one of the most striking events of this conference.

    Project Jigsaw. New fail


    At a coffee break, I met Shuru Ilyin (@shurymury) - he made a presentation at this conference “Project Jigsaw. Take 2 ". I was very glad to meet him and in a friendly manner asked him: “Well, how, ready for the report?”. To which he bewitched me: “Of course I’m ready, because my whole report will carry one simple thought: PFCs! ". I say: “I do not understand what PFCs mean? ". Shura:“ And that means - there will be no Jigsaw, PFCs! More precisely there will be no public modular Java system. ”I am in touch! Shura:“ Imagine, I specially went to JavaOne to listen to Mark (Reinhold) about Jigsaw to make this report, and he states there that we decided not to release a modular system, because no one needs it and asks the audience, “Does anyone here need a modular system?” ... - and a full room of hands! ”As a result, as they later told, Shura put his entire report in 15 minutes, than many disappointed. But believe me, he is no less disappointed! As I.

    One can only guess what happened to the project this time, but I hope that the Java community will not leave it just like that and we will still have a standard modular system in Java.

    Understanding the garbage collection process and what you can do about it


    Then I went to CTO and Co-founder Azul Systems - Gil Tene for an hour and a half. It was a gorgeous report - I highly recommend it. If anyone does not know, Azul started with the production of its Vega multiprocessor computers, where each processor with 54 cores on board and a terabyte of RAM can be inserted into such a machine. And for these computers they made a specialized JVM: they had to solve the problem of scaling their JVM on a huge number of processors and memory. Learning how to make a GC that can scale on huge amounts of memory, Azul decided to give everyone happiness and released a JVM called Azul Zing. This JVM is inherited from HotSpot (there are only MM and GC there), so it works on the same hardware as HotSpot.

    Gil spoke in great detail and about garbage collection in Java, starting with the basics and ending with the most sophisticated techniques, refreshing in my memory everything that I knew about GC. What has served me well, because in a couple of days I also had to tell JUG about GC in our JVM - Excelsior JET . By the way, I was very struck by how Azul GC is similar to ours, at least, externally: it is assembled from the same bricks, but we came to this independently.



    The main idea that Gil tried to convey was that in the process of garbage collection, the point and the GC set that HotSpot has are still far from being set. As a result, an ordinary Java developer needs to know a million pens to configure GC to solve their memory management problems in Java. In his opinion, the pen should be exactly one: –Xmx (we went even further, and even this pen is not needed in our GC ). And instead of hiding your head in the sand and saying that there are no memory management problems in Java, you can try to look at the Java world more widely and find that there are other JVM implementations in which your memory management problems may be better solved.

    It seems to me that this was the strongest report at the conference, so it is extremely surprising that he did not get into the top 10 reports according to the audience’s estimates, despite the fact that the report about the layout of fields in HotSpot objects got into this top. One gets the feeling that people are extremely wary of alternative Java implementations. But why? After all, it’s a great happiness that Java allows you to make alternative implementations and at the same time ensures that your application will work on any Java-compatible implementation. And these implementations can solve problems that Oracle never gets their hands on in life.

    After the report, I managed to talk with Gil: we talked about our GC. I was pleasantly surprised that he knows perfectly well about us. In general, developers of any JVM in the world, as a rule, know about us, which cannot be said, unfortunately, about Java developers.

    Entertaining JVM Technical Support Life Stories


    After lunch (very good, by the way), it was my turn to speak to me: Misha Bykov and Oracle made a joint report. The idea of ​​the report was born in January. The time of the conference successfully coincided with the time of Misha’s vacation, which he decided to spend in Europe and Russia (he lives in the USA himself). Misha works at Oracle Java Licensee Engineering and some time ago he was our official dedicated technical support engineer from Oracle, really helping us pass JCK tests. In addition, he is involved in technical support for large Oracle customers. We also have technical support at Excelsior and all JVM developers, including me, are on duty in turn. Over the years, Misha and I have accumulated quite a few interesting and funny cases from the life of technical support, and we decided to share them with the world. We broke the report into four parts of the most common and typical technical support issues and diluted them with fun stories. We wanted to make the report entertaining, and, it seems to me, we did it: it was fun, the people laughed.



    Scala for professionals


    From our company there was also a report about Scala, which was made by Pasha Pavlov.

    A few years ago, we decided to rewrite the core of our JVM almost completely. One of the essential components of our JVM that distinguishes it from other JVMs is the AOT compiler, that is, a compiler that generates optimized machine code before program execution (“honest exes” are obtained). We decided to rewrite the AOT compiler on Scala, and you know, we did it! Therefore, initially we wanted to make a “Java in Scala” report (as opposed to Java in Java of the rather famous Graal project from Oracle Labs - this is an attempt to rewrite HotSpot JIT in Java), in which we wanted to describe our experience with Scala in such a rather complicated project. But at the vote here, on the hub, the report did not turn out to be so popular, and the organizers asked to change the topic to a more general one, but about Scala. As a result, Pasha had only 2.5 weeks to prepare a report. And he cooked it until the very performance! He managed to make the only run at the airport among the announcements “Passenger Ivanov, urgently get on the boarding gate.” It certainly affected the performance, but I am glad that Pasha still conveyed to people his main idea that Scala is not just the best Java and an independent language with its own ideology and a great future. In the middle of the talk, a funny episode occurred: at the time when Pasha called lambdas in Java 8 “cheap Chinese imitation”, Lesha Shipilev (@TheShade) tweeted: and an independent language with its own ideology and with a great future. In the middle of the report, a funny episode occurred: at the moment when Pasha called lambdas in Java 8 “cheap Chinese imitation”, Lesha Shipilev (@TheShade) tweeted: and an independent language with its own ideology and with a great future. In the middle of the report, a funny episode occurred: at the moment when Pasha called lambdas in Java 8 “cheap Chinese imitation”, Lesha Shipilev (@TheShade) tweeted:



    Bet you have a memory leak in your application?


    When this report appeared at a vote on Habré and unexpectedly became a leader, many were surprised by its topic: how so, Java seems to have garbage collection, and thus, memory leaks are impossible in principle. But this topic did not surprise me at all: in my life I have seen so many of these leaks on the example of our clients!

    The garbage collector collects only those objects that are not accessible through the global (static) fields of classes and from the stack of called methods. And once you get a global field like a hash table, start adding objects there (for caching, for example) and forget about cleaning this hash table, you will immediately have a memory leak.

    Many popular Java frameworks have internal caches (which are often arranged as hash tables) and, without knowing this, you may get a memory leak out of the blue. The report of Nikita Salnikov-Ternovsky consisted in the fact that if you forget to pull this in such a framework, you will get a leak (it is not clear how you should know this).

    Particularly interesting was the case with ThreadLocal. Nikita claimed that if you get a global such as ThreadLocal in your web application, and then re-install this web application (without restarting the server), you are guaranteed to get a leak. We then examined this case in detail at the afterparty with the participation of Lyosha Shipilev and found that there is a bug in the ThreadLocal implementation in the Java API! Then we found ways to treat this, and Lesha promised to report this bug.

    What the Heap Dumps are silent about


    I heard the idea of ​​this report from Lyosha Shipilev at JavaOne in Moscow. He said that he was tired of reading various posts on Habréabout how to correctly display fields in his Java objects, and what he wants to make a report about how HotSpot expands fields. In principle, any Java implementation optimizes the layout of fields in the object for reasons of alignment, the behavior of the processor cache and minimizing the size of the object. Therefore, the order of the fields that you specify in your classes does not mean anything at all: for a JVM, it’s just a set of fields that it’s free to organize as it pleases (both on different JVMs, and even on different versions of the same JVM — this the order may be different). Therefore, there is nothing more stupid in Java programming than trying to optimize something in the order of fields at the source level. But then in Moscow I was surprised how from what I told you here in two sentences, a whole report can be made. But Lesha managed (not without the help of Baruch (@jbaruch),



    In the end, the reaction of the outgoing listeners was amused: “Can you imagine, their fields in the objects there may be completely different!” And once again I was surprised why people are so eager to listen to reports about specific JVM internals.

    Afterparty


    The conference had two afterparties, one unofficial, which was at the end of the first day, and official: after unconference. On the first day, developers of different JVMs were located in one corner, and Java EE masters in the other. And in the middle sat Shura Ilyin, who screamed at the height of the party: “So, here JVM is hardcore, there is a bloody Enterprise, and what am I doing here!”

    Since the afterparty was on the other side of the Neva, those who lived in the hotel had to get there before the bridges were drawn. All this was done in different ways. I left quite early, someone got on a “three-hour” mix, and some didn’t have time for it, and as a result walked around Peter until six in the morning and returned to the hotel in the morning. So the next day, some were unable to attend Unconference.

    Unconference


    What is Unconference none of those who were going to know. On the eve of all the speakers were given two invitations to the event: one for himself and the second speaker could give any listener the first day. And of course, most of the speakers forgot about this invitation, I, however, remembered at the end of the first day and handed it to someone.

    At the beginning of Unconference, Sasha Belokrylov (@alexbel) announced the format: the event is divided into three semantic parts: round tables, where some topics are discussed - they are announced by anyone and for which topics the participants will vote more, those topics are discussed; lightning talks - 5 minute reports on any topic; “Stuffing from the hall” - you can throw a piece of paper with any question into the ballot box and then the whole crowd will answer these questions.



    Initially, not knowing the exact format of the event, I thought to speak with a topic"Web 3.0" , which last year voiced at DevDay in Novosibirsk. This format report does not fit into any conference, and I thought that for Unconference it would be just right. But to my surprise, the report did not fit the declared format: the report lasts several more than 5 minutes. I asked the audience to give me 20 minutes: there was a beginning, few people understood what was happening and everyone agreed. So to speak, they started to warm up.

    In short, the idea that I voiced is as follows. I want to add another application distribution model to the Java platform, in which the application arrives from the network in parts and upon request, and the first (the user interface) arrives from the network. That is, I want to arrange the distribution of Java client applications by the type of Web applications. But this is not Java WebStart (and not applets), where the application is downloaded from the entire network. In my model, applications will fly to the client instantly, like on the web, while they can be arbitrarily complex, like on the desktop. And, which is also important, you can write such applications in any JVM-languages, from JavaScript to Scala.

    In principle, such a technology can compete with the classic web based on HTML + JavaScript. It includes classic web, and at the same time it gives the programmer opportunities that the web in its current state is not able to give and it is not clear when it will be able to. Therefore, I positioned it as Web 3.0. But at Joker, I finally realized that it’s more correct to position this technology as Desktop 2.0, because web developers are embarrassing this idea and they will never sell it to me.

    After me, Gil Tene spoke, who complained that I spoke Russian. He recalled once again that Java has a lot of problems in garbage collection, which are actually challenges and that you don’t have to hide your head in the sand, but solve problems.

    Then there was still a bunch of reports, of which I remembered little. And before lunch, we sorted out “stuffing from the hall”. From the memorable: “Does Java have technical support?”, “Java turns into C ++?”, “How do I commit a fix in OpenJDK?”, “Does Java need as many tests as there are for dynamic languages?”, “Can to catch errors by static analysis?

    After lunch, we gathered in circles. I stated the topic “The Future of Java in RIA and Mobile”, which successfully gained the required number of votes. But, unfortunately, the discussion grew into a flame: it was attended by Victor Polishchuk, one of the conference speakers, who defended the view that the Web is very good for writing client applications today, moreover, it is developing rapidly, and that Java in client- side is simply not needed. I defended exactly the opposite point of view: the complexity of tasks on the web is growing rapidly (on the client side), and that after some time the current technologies based on HTML + JavaScript will solve these tasks too expensive, because web technologies have problems built from birth that are not solved in a natural way. Then Sasha Belokrylov joined the discussion, who said that, starting with some barrier of complexity, writing applications on the web is impractical, but it’s more appropriate to do them in the desktop (which generally supported my point of view without knowing it), and to have WORA (write once run anywhere), you need to write them in Java . But Vitya stubbornly did not agree with this and the question “Is it possible to write Photoshop in web technologies so that it still works conveniently and quickly?”, Without hesitation, he answered - “It is possible!”.

    We also discussed mobile. I shared the pain of many mobile developers: having written an application for one mobile platform, I have to rewrite it almost to another one. As a result, everyone has fun as they can: someone writes in C, someone has fun with JavaScript. And my opinion is that just Java is here to come to the rescue, providing a higher level (compared to C) and good performance (compared to JavaScript). Those present doubted that Java could appear on iOS, because JIT is not possible there (according to iOS policy). To which I spoke about Excelsior JET, which can statically compile Java into machine code, while remaining compatible with Java, and that we have plans to make a solution for iOS. What surprised the audience: even the speakers, as it turned out, rarely know about us.

    I also took part in the discussion about OpenJDK. The topics discussed were that it was extremely difficult for a mere mortal to commit something to OpenJDK and that Oracle engineers have an obvious advantage here. I, in turn, complained that in our implementation we found and fixed quite a few bugs in the Java platform and that we would love to donate these fixes in OpenJDK, but then we may have licensing problems: our code will be released under the GNU license and it’s not obvious whether we can use our code in our commercial license for Java.

    Afterparty 2


    The second afterparty was not far from the hotel, respectively, this time people living in the hotel had no problems with building bridges. We, JVM-schiki, again got bored, than, however, this time plunged Kirk Pepperdine into the gloom: it was extremely difficult for us to discuss JVM problems in English (there was not enough vocabulary) and we discussed them in Russian.



    After the after party, there was another after party with Victor Polishchuk in the hotel. We grappled with Java vs. Java languages Javascript My opinion here is that writing large systems in JavaScript is not environmentally friendly: this language was created for a different purpose. In addition, knowing about virtual runtimes firsthand (after all, 16 years of experience in manufacturing JVMs), I can imagine what the hell it is to optimize JavaScript in the almost complete absence of typical information. But in the end, Vita managed to convince me that by observing some JavaScript programming disciplines (for example, using JSDoc and tools that check static restrictions on input parameters, by the way, does anyone use them?), Large systems can be written in JavaScript. I, in turn, managed to convince Vitya that JavaScript has performance problems. At the end of this conversation, I had a desire to write a total Java article vs. JavaScript: people have an obvious misunderstanding of the nature of these phenomena. But I will write it for a long time.

    JUG: Excelsior JET in action


    The next day, despite the fact that the Joker conference officially ended, it did not end for us with Pasha Pavlov. That day we spoke at the St. Petersburg JUG and talked about Excelsior JET. At St. Petersburg JUG I was invited to speak at JavaOne in Moscow. We agreed in advance for the fall, but in the fall, JUG decided to host Joker. But in order, as they say, not to get up twice, we decided to speak at the JUG too.



    But we were preparing for the conference, and therefore we had no physical opportunity to prepare for the performance at the JUG. As a result, we, as real professionals, drew up the slides in the minibus on the way to the Oracle office in which the meeting took place. Arriving at the office, it turned out that the organizers did not expect that we were going to report from our laptop: we really were going to show Excelsior JET in action, and we did not want to put it on the organizers laptop. But they needed to arrange a video capture of the laptop screen, and for this they needed a special program, which, unfortunately, required .NET 4.0. It turned out that this miracle in feathers weighs more than 200 megabytes and lasts a very long time. Because of this, the beginning of the report moved away, and Lesha Shipilev came to the rescue, who said that VLC can do video capture and does not need .NET. We quickly installed VLC and started the report. And the much-praised .NET was then put on for almost another hour and did not let itself be killed, which in some places interfered with the presentation. Why am I saying this for so long:who will watch the video may not understand without this context of jokes about .NET.

    In general, Excelsior JET, by its code base, is the oldest JVM in the world: there are still quite a lot of code that was written before the advent of Java. But we first publicly talked about him in such detail.

    The report, which was an impromptu almost completely, lasted 3.5 hours, and what surprised me was that the people listened attentively to us and did not leave! But towards the end I was already so tired that I could barely connect two words, especially when I talked about runtime. At the very end, we had a bonus track: compiler hardcore. Pasha Pavlov talked about SSA Regalloc, which was invented in 2005 (which by academic standards means “very recently”), but so far it has not been implemented by anyone except us. And you know, I will never forget the jaws of Lyosha Shipilev and Vova Ivanov sagging to the floor! Pasha knew how to surprise them.

    Jck team


    And at half past eleven, I thought - well, that’s it, you can relax and rest! But I was caught by the JCK team at the exit from the Oraclé office and offered to meet the next day.
    Which we did. I talked about our current problems with JCK, the guys showed new chips in JCK. And you know, for the first time in my life, I felt like an Oracle client at this meeting! The guys are trying for a small group of customers such as IBM, HP, SAP, and it was nice to feel like in this company.

    Peter


    In the time remaining before departure, I managed to walk around Peter. What a beautiful city it is! Definitely better than any San Francisco or Washington.



    In general, the trip was a success, many thanks to the organizers!

    Also popular now: