Crushing Application Latency with Vert,x Paulo

2020-03-01 153浏览

  • 1.Crushing Latency with Vert.x Paulo Lopes Principal Software Engineer @pml0peshttps://www.linkedin.com/in/pmlopes/pmlopes
  • 2.
  • 3.
  • 4.latency noun la·ten·cy \ ˈlā-tᵊn(t)-sē \ Network latency is the term used to indicate any kind of delay that happens in data communication over a network. (techopedia.com)
  • 5.Latency by the numbersAmazon:every 100ms of latency costs 1% in saleshttp://home.blarg.net/~glinden/StanfordDataMining.2006-11-29.pptGoogle:an extra 0.5 seconds in search page generation time dropped tra c by 20%http://glinden.blogspot.com/2006/11/marissa-mayer-at-web-20.htmlAbroker:could lose $4 million in revenues per millisecond if their electronic trading platform is 5 milliseconds behind the competitionhttp://www.tabbgroup.com/PublicationDetail.aspx?PublicationID=346
  • 6.Latency is not the problem it's the symptom!
  • 7.2007: Dan Pritchett Loosely Couple Components Use Asynchronous Interfaces Horizontally Scale from the Start Create an Active/Active Architecture Use a BASE instead of ACID Shared Storage Mode www.infoq.com/articles/pritchett-latency
  • 8.2011 (Tim Fox): Vert.x (event bus) Loosely Couple Components (non blocking I/O) Use Asynchronous Interfaces (clustered) Horizontally Scale from the Start Eclipse Vert.x is a tool-kit for building reactivehttps://vertx.io/applications on the JVM.
  • 9.Why Non-Blocking I/O?
  • 10.5ms / req time ... # In optimal circumstances 1 Thread => 200 req/sec 8 Cores => 1600 req/sec
  • 11.req time grows as threads fight for execution time ... # PROCESS STATE CODES # D Uninterruptible sleep (usually IO) ps aux awk '$8 ~ /D/ { print $0 }' root 9324 0.0 0.0 8316 436 ? D< Oct15 0:00 /usr/bin/java...
  • 12.when load is higher than max threads queuing builds up ... # git@github.com:tsuna/contextswitch.git./cpubench.sh model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz 1 physical CPUs, 4 cores/CPU, 2 hardware threads/core 2000000 thread context switches in 2231974869ns (1116.0ns/ctxsw)
  • 13.grep 'CONFIG_HZ=' /boot/config-$(uname -r) # CONFIG_HZ=1000
  • 14.Practicalexample:Tomcat 9.0 DefaultmaxThreads:200 Avg reqtime:'>time: