[2024 dev2next] virtual threads

Speaker: Piotr Przybyl @piotrprz and @piotrprz@mstdn.social

For more see the table of contents


Note: some things in this talk are in preview features. Might change/get better

Demo

  • Traditional demo of starting a thread and having it wait 10 seconds.
  • Ran 1K platform threads in just over 10 seconds. Ran 30K in 15 seconds. Ran 40K and it crashed due to “not enough space”.
  • Switched to virtual threads and no more resource constraints. Just over 10 seconds for 40K virtual threads. A million virtual threads took about 15 seconds
  • Awesome until see how fooled by demo
  • In the demo is sleeping, not using any resources
  • Redid demo with CPU work so no blocking.

Releases

  • released in Java 21 and previewed in 20-21
  • structured concurrency – preview in 23
  • Scoped values – preview in 22

Virtual threads

  • Great for I/O and waiting
  • No way to switch on and off globally in JDK
  • Don’t make threads faster; Make app scale better
  • Gave NYC example: drive to restaurant and park. Hardware resource (Car) not used. Vs taxi/Uber where don’t care where is when eating
  • If all cars were taxis, could move people faster. But one person doesn’t move faster by just using a taxi.
  • Said not his metaphor but likes it [I like it too]
  • Will not squeeze more juice from your CPU

Don’t Reuse

  • Reuse – cheap to start, create new
  • Pool – requires reusing

Don’t Pin

  • Like car “keep engine running”. Wastes resources, still have to pay.
  • I/O and synchronize pin in Java 21 when takes more than 20ms
  • Find with -Djdk.tracePinnedThreads=full and JFR events
  • toxiproxy – good for chaos engineering. Can set to half a second plus some jitter for variance (or anything you want)

Logging Double slit experiment – “how many lights are there”

  • Observing makes the answer different
  • Changed from 5 seconds of work to five one seconds and added logging.
  • Logging changing behavior because default handler is synchronous.
  • Less finished because opportunities for other threads to get in
  • It’s like everyone calling an Uber when a concert gets out.
  • Every time you do I/O, the thread blocks. ex: get out of taxi
  • Platform threads are different; they don’t block just because you do an I/O operation.

Other problems

  • Can’t ignore backpressure control
  • Ignore interrupts
  • merge with synchronized/native

Structured Concurrency (preview)

  • better “idioms” for multi threaded coded
  • helps eliminate thread leaks and cancellation delays
  • not replacing interruption with cancellation
  • showed waiting on two future. they don’t know the other gave up.
  • each future needs a reference to all other features so they know to give up when implemented manually
  • StructuredTaskScope.ShutdownOnFailure() { // two futures } // allows to know
  • scope.throwIfFailed() knows

Scoped Values (preview)

  • One way immutable ThreadLocals.
  • ThreadLocale is like a cache.
  • Bounded lifetime; visible in code
  • Results in simplified reasoning and improved performance
  • ScopedValue.where(x,y). run(() -> dostuff())
  • Can use Runnable or Callable
  • Can nest where() as long as you don’t mutate it

My take

This was interesting. I didn’t know pinned threads were a thing. Also good humor; well known debug pattern of “debug 1” 🙂

[2024 dev2next] kafka

Speaker: Daniel Hinojosa (mastodon.social/@dhinojosa)

For more see the table of contents


Related tech

  • Piniot – OLAP
  • Input to kafka – kafka streams, akka streams, flink, spark streams
  • Connectors – ex: to database

Kafka

  • publish/subscribe queue
  • producer can also be a consumer

How looks inside

  • messages sharded
  • immutable data store
  • message gets an offset number in the partition.
  • data is temporary – specify retention size or time
  • don’t reuse offset numbers even after message delete
  • can only read/write to leader, not the replicas/followers

Message

  • Similar to a row/record
  • Just an array of bytes; format doesn’t matter
  • Message key is also an array of bytes. Only time something is guaranteed to be in order. Partitioner hashes key and maps to partition.

Batch

  • Group of messages
  • Every batch knows where each partition is going
  • Uses murmur2 for hashing
  • Can set batch size

Acknowledgements (Ack)

  • 0 – no ack; assume all is well; lowest latency
  • 1 – only goes to leader
  • all – all replicates must ack. Higher latency; safest. ex: bank transactions

Consumer

  • goal: scale to a large amount of different consumers without affecting performance
  • Consumers are not threadsafe
  • Consumer rebalance – mitigate when consumers go down
  • Settings: Isolation level

Producer

  • Settings: idempotent, transactions

Compaction

  • Retain message of same key where only latest message will be retained.
  • Cleaner thread does compaction
  • Can treat as events or tables
  • Tables treat Kafka as key/value database
  • LIkely don’t care about past with respect to table. Care about current/end state not everything that happened along the way.
  • Dirty – extra records

Stream processing

  • Everything is consumer/producer. Everything else is just a higher level
  • Stream groups
  • Java type stream methods – peek. foreach, groupByKey

My take

I used to know some of this, but had forgotten it so excellent review. And the new stuff was good too! I wish the screen had different resolution rather than relying completely on zooming in. Would have allowed to see some stuff while running, live code changing, and the web page (which weren’t magnified). The extended demo was great though! The gitpod “sales pitch” was a nice side effect.

[2024 dev2next] Shaping your hiring process

Full title: Shape Your Hiring Process to Attract & Engage Better Tech Talent

Speaker: Erica Woods

For more see the table of contents


Notes

  • Motivation for talk: 8 candidates declined in a row

Top 10 reasons managers lose good candidates

  • Lack of flexibility/WFH
  • Lengthy process
  • Rigorous process/bad experience/over interviewed
  • Poor engagement
  • Not “sold” (poor marketing)
  • Inaccurate/incomplete job details
  • Unrealistic requirements list
  • “Too many cooks” issue
  • Not enough money
  • Counter offers/better offers

Think about

  • How many steps?
  • How long between?
  • How long total? – ideally 2-3 weeks. Or 1 week for great candidate
  • Where can we lessen?
  • Personal mentality?
  • What else can we do with candidates we like?

Other problems

  • Rescheduling interviews so many times
  • Communicate roadmap if more appealing
  • Titles that don’t have meaning – “I don’t work there; I don’t know what that means” – ex “Solution Engineer 3”. Add “we are looking for someone to act as <common role name>”
  • 456 different BA titles across clients

Position attractors – 10P model. Include some in job description. Can divide and conquer so different interviewers cover different ones. Also good checklist if you are interviewing.

  • Purpose
  • Project
  • Problems – ex: what do in next 6 months
  • Priorities
  • Place – ex: location vs remote and place within organization, size of team
  • People
  • Perks
  • Pay
  • Path/Potential
  • Pain Points

80/20 rule

  • Identify candidates with 80% of the requirements
  • Make rest nice to have
  • Identify growth opportunities
  • Communicate training opportunities

Rapport

  • Chit chat
  • 92-93% interviewees are nervous
  • 2 minute rule start out
  • Other specifics about yourself
  • On video, eye contact (with camera) and show hands
  • Commonality via resume/linked in
  • Understand motivators and align responsibilities and tech stacks
  • Help visualize working there
  • Physical or virtual background as icebreaker
  • Bring up stuff from Linked In – shared connections, info

Candidate scorecard

  • Points given for various skills. Also text areas
  • Ask team what important for all positions with respect to soft skills
  • Differentiate between culture fit vs role/tech skills
  • Share with hiring partners so get better candidates over time
  • In Germany, can’t keep the data unless candidates consent. Not all candidates will give it.

AI

  • Market research (skills, salaries, insights)
  • Job descriptions – ask to make more attractive for role
  • Candidate vetting/skills identification
  • Interview questions
  • Communications (offer or rejection letters)

Other notes

  • Review process annually
  • Remember your interview experience and what care about as candidate. Would you apply for this job?
  • Copilot can help clean up job descriptions. They use good language
  • All apex recruiters are skillset focused.
  • Requirement “what I need; list of skills” vs opportunity “here’s how this will be a fulfilling career move”
  • Candidates now taught to ask AI to learn about person
  • If intimidating because of social media, have recruiter humanize you by telling a story
  • Candidates often felt bombed even when did fine. Managers ask an escalated line of questioning; you aren’t going to know anything

My take

I was a little tired. A few sentences in this little boy walks in. Erica invites him to sit down. He does and then says his mom might worry where he is because he was in the bathroom. Then left. So cute and woke me right up.

Erica warned us several times up front it is a marketing heavy presentation. That was fine; different perspectives are nice. Overall good, I do wish it was targeted more to the audience. Some of the stuff is things developers/architects/teams can’t just change. Similarly, a Project Manager position as the job description example isn’t the best fit for the attendees of this conference. But there were also lots of things that the actual interviewer can do. Audience interactivity was great