[QCon 2019] Rockstar Java Performance Panel

Todd Montgomery, Kirk Pepperdine and Bert Ertman

For other QCon blog posts, see QCon live blog table of contents

Quotes

  • “If you don’t create garbage, you aren’t going to have a problem with the garbage collector” – Kirk
  • ”Performance is in the eye of the beholder” – Bert
  • “Once you see it you can’t stop seeing it” – Kirk
  • ”Need to adjust containers in a sensible way” – Kirk

GC

  • Memory churn is an issue. But observability bad so cant see. -Kirk
  • GC allocation rate not the problem. It’s the result of the collection – Todd. Immediately Kirk disagrees
  • Don’t fear allocating objects, but don’t be wasteful. Parsing a String in the JDK is wasteful – Todd
  • Allocation rates still matter. Have to use CPU to allocate. Can fill a water tower one spoon at a time -Kirk

Solutions

  • Write simple code first -Todd
  • Never stop making it better. You may pause or decide not enough time. But never really done – Todd [this sounds like good enough]
  • A good engineer wants it to take less time. Will plan up front to type less. But also can’t stop thinking about how to make it better. However, might not be able to get the chance to do so. -Todd. As a counter, Bert noted that time runs out eventually and ok i have met no-functional requirements.
  • Get data – Kirk

General

  • First question is whether what customer wants is possible – Todd
  • A lot of the tools lie to you – Kirk
  • Profile disruption – Kirk
  • Have ore than one tool – Todd

Tools

  • Async profler – Todd
  • Flight recorder Todd. Looking at adding perf data – Kirk.
  • perf on linux – Todd
  • Remove/reduce logging – Todd. Seconded by Kirk. Good at finding the problems that have already been solved and likely won’t occur again.
  • perf – Kirk
  • GC logging – Kirk
  • Jmeter and other tools. Use with cloud based apps – Bert

Cloud vs hardware

  • Can start taking some variables out for serverless – Todd
  • There’s a lot between you and the actual hardware. Some tricks don’t work -Todd
  • Idiomatic parts of Java still work. Simple designs. Decoupled. No shared state – Todd
  • Underprovisioning other parts of hardware. Ex: focus on CPU and not network – Kirk
  • JIT compiler can produce different results depending on part of memory used – Kirk
  • Can look at assembly generated from JIT to counter this – Todd
  • Serverless often used as glorified REST API or glue code More config needed- Bert. Kirk countered that won’t happen because IT compiler is still going half an hour For complex code, could be hours or never for JIT to have stable plan. Sometimes stabilize in less than optimal config. Emergent just about every time restart – Kirk

Questions

  • Spring boot? Not using would be premature optiimization. Can tweak after – Kirk
  • How much knowledge of OS should have? As much as can -Kirk. It’s something that is there and have to live with. The more you understand it, the less it seems like magic. – Todd, The better you know environment the better can accoomdate it – Kirk. Better understand illusions. Writing to memory not immediate – Todd. Kirk asked who knows what a DDR4 chip layout is. More than zero :). Incorporated into chip design
  • Performance tuning on how deal with which quadrant? Yes. Deal with threads being on different cores with different profiles. Can only control so much. Don’t take into account unless want to go fully into it – Todd. Unless you are Todd, don’t go off heap – Kirk
  • Performance difference between Open JDK and Oracle JDK? Many JDKs based on same Open JDK core Difference in patches applied for bugs backported So performance shouldn’t vary. -Kirk Everyone should be supporting Adopt Open JDK. Only community supported distribution – Todd and Kirk. Todd uses Oracle JDK less but his clients do.
  • Cloud JDK? Depends on distribution. Amazon has own JDK now. Also bring your own runtime – Bert
  • More on how profilers lie? Not malicious. Profilers sample. A lot happens between savepoint – Todd. One thread can stop all others including GC. Samplers can show conflicting views of the same data. Biggest gain is o get application do wha wanted it to do in the first place. A lot of profilers work on differentials – Kirk
  • How generate less garbage? Find hot allocation sites and get rid of them -Kirk. Primitive data structures using boxed version instead of actual primitive version. Consider primitive instead of Object Be careful, but sometimes allocating a pool helps. Not always the best solution. Look at API have Can you reuse common aspects – Todd
  • Avoiding mutable state increases allocation rates. Kirk cringed. Doesn’t like mutable state, but not going around making everything immutable. Final comes with consequences. Proper encapsulation helps avoid need for immutability. Do you real need getter/setter Embed responsibility in object instead – Kirk. Absolutes are wrong. There’s always exceptions. Mutable state not a bad idea. Shared mutable state is the problem. Have one thread handle writes. – Todd. HashMap not a word used in business terminology. Missing a domain term in model – Kirk. Indiscriminate use of final is a bandaid over modeling issue – Kirk
  • How avoid getters in CRUD apps. Need gets at edge of system. Ex: database, GUI. In middle of system, don’t need to externalize – Kirk, Streaming set of change – Todd
  • Microservices? Not all services are designed for reuse. Time to market is the driver – Bert. REST is terrible from a model perspective. A lot of time spent parsing ASCII – Todd. Can parse a lot of ASCII in one network call – Kirk
  • Serialization? Dislike ORM as already had data. Easier to learn SQL – Todd. Kirk disagrees with SQL part. Wire friendly formats better than serialization. Or make them events – Kirk
  • When god to use object pooling? Someone said never. (I thin Kirk) Needs to pay for itself – Todd. Small object that are churned will be removed by the JIT. Large objects that are expensive may pay or self. But then it is like writing own GC. – Kirk
  • What features most excited for? Don’t look what coming to avoid disappointment – Todd. Fibers. Adding more work generally makes things slower. But fibers reduce thread count so might have benefits in some situations – Kirk
  • How make custom profiler? Look at problem to see what info need. Extend what need. Could be bytecode analyzer or an existing profiler. No two are the same when customize profiler. Tune in prod. Profilers will like sometimes. Test environments almost always lie. So lower sampling rate/impact since run in prod – Kirk. Very few organizations have test environment that mirror prod in any real way. Happy accident when tuning test environment improves prod performance – Todd
  • What resources recommend? Mechanical sympathy mailing list. – Kirk

My impressions

The three panelists chatted for a while before the panel started. They clearly look just as comfortable on stage then when just standing around. They interact well ad it is fun. It would have been nice if they had more than one mic to share across the three of them. During the day, I understand there re only so many mics. But right now only two rooms are in use. So I wish we could have been given the Q&A mics to borrow from other rooms. I learned a lot. Also, I brought a snack in case was hungry since the session starts/ends late in the day. I was engaged enough by the session that I wasn’t hungry enough to be distracted! Also Sai: thank you for volunteering to run the mic!

[QCon 2019] State of Serverless Computing

Chenggang Wu – Berkley

For other QCon blog posts, see QCon live blog table of contents

General

  • 2000 students in intro class at Berkley last year. Put them in concert hall
  • How make them more productive so can work on cheap machines like Chromebooks
  • Hosted infrastructure/cloud
  • Companies dedicated to making serverless easy

FaaS (Function as a Service)

  • Run code and pay for only what use
  • ex: AWS Lambda
  • Optimized for simplicity
  • Good at
    • embarassingly parallel tasks – video processing, translation
    • workflow orchestration
  • Limitations
    • Limited execution time – AWS increased from 1 minute to 5 minutes and then again to 15 minutes
    • No inbound network connection
    • IO is a bottleneck
    • Doesn’t support specialized hardware
    • Not designed for functional programming because real applications share state. Also, no natural way to chaining/composing functions. Using hacks to get around that introduces latency. AWS Step Functions even slower than hacking with S3 or Dynamo.

BaaS (Back End as a Service)

  • ex: AWS Athena
  • more specific

Storage

  • Want both autoscaling and low latency
  • In practice, improving one makes the other worse.
  • Autoscaling systems also provide poor consistency guarantees

Berkley’s work

  • Platform for serverless computing
  • working on supporting state
  • Anna – data store used in place of S3. Chenggang worked on for PHD
  • Fluent – FaaS over Anna. Working on new name since already a project named Fluent. Use Anna for both storage and communication reduces crossing network boundary.
  • Cache data to increase performance
  • Lattice – data structure that accepts incoming data. Preserves associate, community and idempotent properties.
  • Casual consistency – strongest consistency level that doesn’t require coordination

My impressions

Good end to the sessions for the day. The material was well laid out and easy to understand. The snails were cute when highlighting slowness! I like that most of it wasn’t specific to the research project at Berkley. The Berkley work was interesting, but less applicable.

[QCon 2019] Liberating Structures

Greg Myers from Capital One

For other QCon blog posts, see QCon live blog table of contents

General

  • Few meetings include engagement
  • Many tech managers consider meetings for their staff
  • Can help with white elephants – the things we don’t normally talk about
  • There are 33 defined liberating structures http://www.liberatingstructures.com
  • Retain more info because face to fact and involved
  • Planning poker is a diversity initiative. It’s about the discussion, not the #

Liberating Structure #1

  • Write down a worthy but elusive goal. Share with a neighbor.
  • Energy went up
  • Repeat with a new neighbor
  • Goal gets clearer with iteration
  • Liberating: permission to talk to someone don’t Know
  • Structured: rules, time constraints
  • Write on paper:: introverts can express self. Extroverts have time to think

Liberating Structure #2

  • Write down why hard to make progress on worthy but elusive goal
  • Troika Consulting
  • Explain problem. Ask clarifying questions
  • Turn around and listen as other two talk about problem
  • Shake hands at end and say thank you
  • Then let it go

Liberating Structure #3

  • 15% solution. What’s one thing you could do ow, totally within your control that would get you closer to your goal. We didn’t do this exercise so there was time for questions.

Liberating Structure #4

  • 1-2-4-all
  • Everyone writes a question
  • Partner to improve question
  • Merge groups (we ran out of time so didn’t get that far)
  • Asked partner who heard a good question and got some. Showed energy higher and more questions

Meeting Elements

  • Invitation – Common negative “invitations” are “listen to me” and “tell me what I want to hear”
  • How space is arranged – want to signal and reinforce activity
  • How participation is distributed – how invite. Want to belong and not just be tolerated
  • Sequence of steps and time allocation – think about what whole group needs

My impression

I like that he started with two liberating structures. I would have liked to experience more. I thought there was actually going to be a Q&A when he asked if we’d rather ask questions. That said, this session did motivate me to buy the book (because I have re time to read offline). It was a good session, but I wanted more!