Consistent hashing

Great explanation of the concept:

https://www.toptal.com/big-data/consistent-hashing

Main points:

  • hashing formula (provides angle for each node or key): 360/INT_MAX * hash(key), where INT_MAX depends on implementation of hash() function (in the article INT_MAX = 10^10)
  • Only k/N keys need to be remapped when k is the number of keys and N is the number of servers (more specifically, the maximum of the initial and final number of servers)
  • application of weight x10 in the article implies assigning to server A labels A0..A10 and hashing them one by one

Notes from react.sphere 2018

https://www.gremlin.com – chaos engineering tool (aka symian army from netflix)

highscalability.com – solutions for high scalability of internet giants

http://nurkiewicz.github.io/talks/2018/reactive-lessons/#/18 – slides from presentation of Tomasz Nurkiewicz

https://theburningmonk.com – articles about serverless (AWS lambda in particular)

https://github.com/codepitbull/vertx-scala-kubernetes-demo

Misc thoughts

Never mock a type you don’t own //context is lost, perhaps taken from here

Lambda per verb (i.e. delete user) – allows permissions segregation, better finance tracking, better insight on capabilities (it’s clear what it can do based on it’s name) //advice from theburningmonk

Write metrics to log to avoid io waits //advice from theburningmonk, mentioned in the context of lambdas topic

Notes from JDD 2016

Topic: Flying to cloud
Main idea: How to move an app to the cloud, how easily this can be done with spring-cloud, spring wraps lots of libraries from netflix to make it integrated with its own ecosystem + adds some default behavior

Good book: Migrating to cloud native application architecture (http://12factor.net)
Possible problems: Global locks, leadership election

Spring cloud benefits:
Circuit breaker (histryx) works OOTB
@FeignClient and @EnableFeignClients allows to group replicated clients and add load balancing (with Ribbon annotation), also OOTB

media-20161010-1 media-20161010-2 media-20161010

 


Topic: Fast feedback
Main idea: Lots of upcoming problems could be solved by achieving the fast feedback in many different areas. Author describes many techniques he uses on his projects

When throwing exception: add some context on different stages, then rethrow – this practice eliminates time spent on the issue analysis
mvn – T – allows parallel build execution (has many options):

mvn -T 4 clean install # Builds with 4 threads
mvn -T 1C clean install # 1 thread per cpu core
mvn -T 1.5C clean install # 1.5 thread per cpu core

Static analysis:

  • use blacklist (filter) instead of whitelist of rules, to stay up to date with new rules suggested by PMD, FindBugs etc.
  • ben-manes plugin scans your project and shows if there are new libraries to use
  • mutation testing: pitest.org
  • NonDex – analyze wrong assumptions about Java api
  • CodeNarc – static code analyzer for Groovy

Topic: Security
Main idea: Author gives some advices on how to keep quality of the security on the project

Letsencrypt – gives free SSL certificates (yet you should pay for hosting of the certificate)
OWASP ASVS – security standards for developer
ZAP Zed attack proxy – helps to find security vulnerabilities
SAMM Overview – maturity model


Topic: Non-blocking microservices
Main idea: How one team moved their code and infrastructure to non-blocking IO

Someone had calculated that 1 thread ~1mb, which costs 8$ per year to maintain
First they’ve looked into JAX-RX 2.0 which supports async responses.
BUT:
Non-blocking servlet servlet will require non-blocking filters, which have to be written customly
So they moved to pure HTTP.
CompletableFuture (Java 8) allows to chain futures (like promises in JS).
Migration requires functional decomposition, to allow easy chaining.
Recommended Netty + async http client.
Move to NIO rather in case of low CPU loads, to benefit


Topic: Metrics gathering
Main idea: How one team gathered metrics

They’re using io.dropwizard.metrics:
– metrics-core
– metrics-spring – spring integration
– metrics-jvm – collect gc metrics
Works with @Timed annotation

Graphite and graphana – ui and storage for metrics
Read More