akka streams – viktor klang – qcon

This is part of my live blogging from QCon 2015. See my QCon table of contents for other posts.

Streams are:

  • Ephemeral – time dependent
  • Possibly unbounded in length
  • Focus on transformation and transformation of data

Programming involves moving things from A to B and changing the bytes along the way.

Akka

  • message oriented programming model for reactive apps
  • can be used from Java or Scala.

Actors

  • unit of proessing a called an Actor
  • component with address, mailbox, current behavior and storage
  • No CPU cost if actor doesn’t have someting to do. Only use a few bytes each so scale well
  • Each actor has a parent- handling for failures

Akka Streams

  • Higher order abstraction for concurrency
  • Solving the 100% case is impossible and 90% case is hard. Akka focuses on 80% case. Solve most problems
  • Immutable, reusable, composable, coordinated, async transformations.
  • Flows – one input and one output. Not connected to source or destination. Like a reusable pipe. Goal is to describe the transformation.

Types of transformations

  • Linear Time-agnotistic -ex common ones like map
  • Linear Time sensitive – ex dealing with infinite streams
  • Linear Rate detached – ex how deal with buffering
  • Linear Async – ex calling a service
  • Non-linear – ex binary flow (two inputs going to two outputs), custom stages

Sources – publisher, iterator, future, etc

Sinks – subscriber, foreach/fold/onComplete, ignore, head, etc

Fan in/fan out – merge, zip, etc

Output/Input – Http, tcp, InputStreamSource/OutputStreamSink blocking wrappers, etc

Materialization – taking description of transformation and making it run. Streams are blueprint. Materializer makes it run. Cycles are allowed. Look for troublesome ones.

If can’t solve problem without programming; wnt be able to solve it without programming. Why would be able to tell a computer how to do something if we don’t understand it either.

Push vs pull

  • Want to get data across async boundary without blocking back-pressure.
  • When pushing data, have to drop if get it too fast.
  • “A slow solution is no solution”
  • Pull can be slow
  • Better: Two way channel – only push when know ready. Know what needed based on requests. Don’t demand 100 ice creams unless know what to do with them. Switching between push/pull and batching requests when know about related ones. Called “dynamic push pull”

Also see The Reactive Streams Initiave

Impressons: good talk; learned a lot. Both about Akka and conceptually. Glad I’m comfortable with the basics of functional programming so it wasn’t overwhelming.

how did we end up here – todd montgomery and tisha gee – qcon

This is part of my live blogging from QCon 2015. See my <a /2015/06/10/qcon/”>QCon table of contents</a> for other posts.

When new, we assume everone knows what they are doing and everything is logical/clean/organized. Yet, reality is messy. Sometimes get to the point where can’t touch anything. Sometimes get to the point where proud of over-engineered/terrible solutions.

Software process stats

  • agile and iterative have similar project success rate
  • Ad-hoc and waterfall are similar
  • Agile/iterative is only a little better
  • Projects with less than 10 people significantly better than twenty or more
  • Different reports mesure successful projects differently. 30%- 60%.
  • More expensive project not better “throwing more $ at projects don’t make it better” [wouldn’t this be because of size of project; not throwing $ at it?]

Enterprise architect == so good at job that no longer do development. Surgeons design systems not people who used to,

More organizations are looking at contributions to open source to prove can do development before start. No place to hide; mediocrity becomes visible. Open source is not a business plan, but can be a distribution model.

Agile

  • Minimal viable product – people don’t want to buy MVP. Why aim for it? [we don’t it is about doing that first so guaranteed to have a base]
  • Product owner – why can’t talk to real customer. Why need a proxy? Want direct feedback. Actually pairing with customer to see how use app brings up usabiity/process issues. Technology should be part of the business.
  • Poll: how many people doing agile release less than every 3 months? A few
  • Water-scrum-full – tiny waterful. Do scrum practices, but ignore retrospective and still waterfall. Should focus on learning, feedback cycles and outcomes
  • Projects often succeed because 1-2 people make it happen in spite of process. Find out by thinking “what would happen if you weren’t involved”

“Shared mutable state” should be scary. Should be for sysetms programming where domain is smaller and understand hardware. Otherwise, shouldn’t be taken for granted. Embrace append only, single writer and shared nothing designs.

Ambdal’s law says can only scale up to a certain # of CPUs before maxing out. Universal Scalability Law says it gests worse well before that. “Coherence penalty”

Simplicity is better

Text encoding (JSON, XML) doesn’t need to be human readable. It’s computers talking to each other

Have to deal with probems and lack of response for both synchronous and async communication

Errors need to be first class messages. Java Exceptions name imply they are unusual cases. Don’t know what to do with them anyway.

Abstractions shouldn’t mean generalization. hould be about creating a semantic level so can be more precise.

Issues: Superiority complex with different technologies/techniques and anyone who says otherwise is wrong. Religious wars. X is the solution to everything.

Functional programming is not the anwer to multi-core. The math (universal scalability law) still hits . [still helps up to a point though on the graph]

Think about transformation and flow of data; not code

Hardware

  • Mobile makes us think about hardware again – battery and bandwidth. Free lunch on throwning hardware at problem is over
  • Hardware has been designed to make bets on locality and predictable for access. Pre-fetching and the like make an order of magnitude difference.
  • Bandwidth is increasing. Latency is staying the same.

Diversity

  • Testosterone Driven Development
  • Increase in women went up with other STEM fields. Then in CS it started declining in 1980. This is when PCs were introduced at marketed to boys.
  • Can catch up in a year even if start coding in college.
  • Grace Hopper invented COBOL and the compiler
  • Margret Hamilton invented async programming via NASA

Don’t be afraid to fail

Impressions: great substitute keynote. I wonder how long they had to practicing together. Trisha said she’s seen it given before (with Martin Thompson)

java mini talks at qcon

This is part of my live blogging from QCon 2015. See my QCon table of contents for other posts.

This session is four 10 minute talks.

Determininistic testing in a non-deterministic world

  • determinism – everything has a cause and effect
  • pseudorandom – algorihtm that generates approximately random #s

Should see LocalDateTime with Clock instance to reproduce results in a program. There is a fixed clock so all operations in program see the exam exact time. Similar to using a random seed for generating numbers.

Hash spreads and probe functions: a choice of performance and consistency
primitive collections faster/less memory than boxed implementations. Uses 56 bytes for each Integer.

  • hash spread – function that destroys simple patterns in input data while presuming maximal info abobut input. Goal is to avoid collisions without spending too much time hashing.
  • hash probe – function to determining order of slots that span array. For example a linear probe goes down one slot if collision. A quadratic probe goes down down further if collision

Typesafe config on steroids
Property files are hard to scale. Apache Commons adds typing, but still limits to property file format and limit composition. Spring helps with scaling property file.

Typesafe Config – library used by Play and Akaa Standalone project without depenencies so can use in Java. JSON like format called HOCON (human optimized config object notation)

Scopes – library built on top of typesafe config

Real time distributed event driven computing at Credit Suisse
Credit Suisse produced own language that they call “data algebra”. Looks like a DSL.