ActiveMQ Performance Tuning

Christian Posta
Christian PostaGlobal Field CTO at Solo.io
© 2012 FuseSource Corp.All rights reserved.1	
  
Apache	
  Ac(veMQ	
  Performance	
  Tuning	
  
Chris(an	
  Posta
Senior	
  Consultant	
  and	
  Architect	
  
Blog:	
  h6p://chris9anposta.com/blog/	
  
Twi6er:	
  @chris9anposta	
  
GitHub:	
  h6ps://github.com/chris9an-­‐posta	
  
© 2012 FuseSource Corp.All rights reserved.2	
  
ceposta	
  	
  
§ Chris9an	
  Posta	
  
§  Blog:	
  h6p://chris9anposta.com/blog/	
  
§  Email:	
  ceposta@apache.org	
  
§  Twi6er:	
  @chris9anposta	
  
§  GitHub:	
  h6ps://github.com/chris9an-­‐posta	
  
§  Goolge+:	
  h6ps://plus.google.com/103810850748178017238	
  
	
  
	
  
§ Senior	
  Consultant	
  and	
  Architect	
  at	
  Red	
  Hat	
  (formerly	
  
FuseSource)	
  
§ Commi6er	
  on:	
  Ac9veMQ,	
  Apollo	
  
§ Author	
  of	
  Essen%al	
  Camel	
  Components	
  DZone	
  Refcard	
  
© 2012 FuseSource Corp.All rights reserved.3	
  
What	
  Am	
  I	
  Talking	
  About?	
  
§  What	
  is	
  Ac9veMQ?	
  
§  Performance/Benchmarking	
  Tools	
  
§  Tuning	
  
© 2012 FuseSource Corp.All rights reserved.4	
  
Apache	
  Ac(veMQ	
  
§  OpenSource	
  Messaging	
  Server	
  
•  Queues,	
  Topics,	
  persistent	
  messaging,	
  high	
  
availability,	
  etc	
  
§  Apache	
  v2.0	
  License	
  
§  Ac9ve	
  community,	
  Mature,	
  Stable	
  
§  Used	
  at	
  top	
  companies	
  
•  Insurance,	
  banking,	
  retail,	
  ecommerce,	
  health	
  
care,	
  avia9on,	
  shipping,	
  et.	
  al!	
  
§  5.8.0	
  latest	
  release	
  
© 2012 FuseSource Corp.All rights reserved.5	
  
Apache	
  Ac(veMQ	
  
§  High	
  performance	
  
§  High	
  Availability	
  
§  Light-­‐weight	
  
§  Mul9-­‐protocol	
  
§  JMS	
  compliant	
  
§  Supported	
  in	
  Produc9on	
  
© 2012 FuseSource Corp.All rights reserved.6	
  
Accessible!	
  
§  Java	
  
§  C/C++	
  h6p://ac9vemq.apache.org/cms/	
  
§  .NET	
  h6p://ac9vemq.apache.org/nms/	
  
§  PHP	
  
§  Python	
  
§  Ruby	
  
§  PHP	
  
§  JavaScript	
  	
  
§  Telnet!	
  
§  Any	
  that	
  can	
  make	
  a	
  TCP	
  connec9on	
  and	
  send	
  Text!	
  
	
  
© 2012 FuseSource Corp.All rights reserved.7	
  
Transports	
  
§  TCP	
  
§  UDP	
  
§  SSL	
  
§  NIO	
  
§  HTTP/s	
  
§  VM	
  
§  WS	
  (Web	
  Sockets)	
  
§  WSS	
  (Secure	
  Web	
  Sockets)	
  
© 2012 FuseSource Corp.All rights reserved.8	
  
Wire	
  Protocols	
  
§  Openwire	
  
h6p://ac9vemq.apache.org/openwire.html	
  
§  Simple	
  Text	
  Oriented	
  Messaging	
  Protocol	
  
(STOMP)	
  
h6p://stomp.github.io	
  
§  AMQP	
  1.0	
  
h6p://www.amqp.org/resources/specifica9ons	
  
§  MQTT	
  
h6p://mq6.org	
  
§  HTTP/REST	
  
© 2012 FuseSource Corp.All rights reserved.9	
  
Ac(veMQ	
  Features	
  
§  Master/Slave	
  fault	
  tolerance	
  and	
  High	
  Availability	
  
§  Broker	
  “networking”	
  or	
  clustering	
  
§  Pluggable	
  persistence	
  (KahaDB,	
  LevelDB,	
  JDBC)	
  
§  Broker	
  interoperability	
  (RabbitMQ,	
  HornetQ,	
  etc)	
  
§  Virtual	
  Topics	
  
§  Mirrored	
  Queues	
  
§  JMX	
  Monitoring	
  
© 2012 FuseSource Corp.All rights reserved.10	
  
When	
  to	
  use	
  Messaging?	
  
§  Asynchronous	
  communica9on/integra9on	
  
§  Durability	
  
§  Loose	
  coupling	
  
§  Heterogenous	
  integra9on	
  
§  Real-­‐9me	
  data	
  
© 2012 FuseSource Corp.All rights reserved.11	
  
Configura(on	
  
Ac9veMQ	
  is	
  Highly	
  Configurable!!	
  
© 2012 FuseSource Corp.All rights reserved.12	
  
Performance/Benchmarking	
  
Tools	
  
© 2012 FuseSource Corp.All rights reserved.13	
  
So	
  What	
  Are	
  We	
  Covering?	
  
§  Tools	
  
§  How	
  to	
  approach	
  performance	
  tuning	
  
§  Areas	
  to	
  tweak!	
  
© 2012 FuseSource Corp.All rights reserved.14	
  
What	
  are	
  Your	
  Objec(ves!?	
  
§  Please,	
  please,	
  please..	
  Know	
  
what	
  you’re	
  trying	
  to	
  
accomplish!	
  
§  Know	
  your	
  use	
  cases!	
  
§  Know	
  your	
  hardware/OS	
  
§  Understand	
  all	
  of	
  the	
  broker	
  
config	
  changes	
  you	
  make!	
  
§  VALIDATE	
  YOUR	
  CHANGES!	
  
© 2012 FuseSource Corp.All rights reserved.15	
  
Broker	
  Benchmarking	
  Tools	
  
§  Ac9veMQ	
  Performance	
  Module	
  
§  jms-­‐benchmark	
  
§  JMSTester	
  
§  Apache	
  Jmeter	
  
§  Grinder	
  
§  …?	
  
© 2012 FuseSource Corp.All rights reserved.16	
  
Ac(veMQ	
  Performance	
  Module	
  
§  Part	
  of	
  the	
  Ac9veMQ	
  Build	
  
h6p://ac9vemq.apache.org/ac9vemq-­‐performance-­‐module-­‐users-­‐manual.html	
  
§  Maven	
  plugin	
  
§  Quick	
  and	
  easy	
  to	
  get	
  started	
  
§  Flexible	
  
§  Records	
  throughput,	
  basic	
  sta9s9cs,	
  and	
  CPU	
  
metrics	
  
© 2012 FuseSource Corp.All rights reserved.17	
  
jms-­‐benchmark	
  
§  Opensource	
  at	
  github,	
  from	
  Hiram	
  Chirino
h6p://github.com/chirino/jms-­‐benchmark	
  
§  Comprehensive	
  benchmarks	
  
§  Configurable	
  
§  All-­‐on-­‐one	
  
§  Mul9ple	
  brokers	
  
§  Pre6y	
  graphs!	
  
© 2012 FuseSource Corp.All rights reserved.18	
  
JmsTester	
  
§  From	
  FuseSource	
  	
  
h6p://jmstester.fusesource.org	
  
§  My	
  branch:	
  
h6ps://github.com/chris9an-­‐posta/jms-­‐tester	
  
§  Allows	
  more	
  complicated	
  load	
  tes9ng	
  
§  Distributed	
  
§  Records	
  messaging	
  throughput	
  and	
  CPU,	
  Memory,	
  
Network	
  IO,	
  Disk	
  IO,	
  et	
  al.	
  	
  
§  Thorough	
  documenta9on	
  	
  
§  My	
  blog	
  post:	
  	
  
h6p://www.chris9anposta.com/blog/?p=268	
  
© 2012 FuseSource Corp.All rights reserved.19	
  
JMeter 	
  	
  
§  Swiss	
  army	
  knife	
  of	
  load	
  tes9ng	
  
§  From	
  Apache	
  
h6p://jmeter.apache.org	
  
§  JMS,	
  HTTP,	
  TCP,	
  SOAP,	
  JDBC,	
  	
  and	
  many	
  others	
  
§  Many	
  aggregators	
  and	
  repor9ng	
  features	
  
§  Mature	
  product,	
  well	
  known	
  
© 2012 FuseSource Corp.All rights reserved.20	
  
OS	
  Tools	
  
§  Lest	
  we	
  forget…	
  rely	
  heavily	
  on	
  the	
  tools	
  your	
  Opera9ng	
  
System	
  exposes!	
  
§  Linux	
  
•  top	
  
•  iostat	
  
•  netstat	
  
•  vmstat	
  
§  Windows	
  
•  Built	
  in	
  process,	
  resource	
  monitors	
  
© 2012 FuseSource Corp.All rights reserved.21	
  
Ac(veMQ	
  Performance	
  Module	
  
§  Maven	
  plugin	
  
§  Can	
  use	
  exis9ng	
  project:
h6ps://svn.apache.org/repos/asf/ac9vemq/sandbox/ac9vemq-­‐persest	
  
§  Spin	
  up	
  producers,	
  consumers	
  
§  Control	
  number	
  of	
  threads,	
  test	
  dura9ons,	
  etc	
  
§  Stats	
  and	
  Repor9ng	
  
•  Throughput,	
  min/max,	
  broken	
  down	
  per	
  client	
  
	
  
	
  
	
  plugin	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  groupIdorg.apache.ac9vemq.tooling/groupId	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  ar9factIdac9vemq-­‐perf-­‐maven-­‐plugin/ar9factId	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  version${ac9vemq-­‐version}/version	
  
	
  /plugin	
  
© 2012 FuseSource Corp.All rights reserved.22	
  
Using	
  Performance	
  Module	
  
§  Example:	
  
§  Out	
  of	
  the	
  box	
  examples:	
  
§  Other	
  out	
  of	
  the	
  box	
  profiles:	
  
•  Producer	
  
–  AMQ-­‐Prod-­‐1-­‐1-­‐queue-­‐nonpersistent.proper9es	
  
–  AMQ-­‐Prod-­‐10-­‐1-­‐queue-­‐nonpersistent.proper9es	
  
–  AMQ-­‐Prod-­‐10-­‐10-­‐topic-­‐persistent.proper9es	
  
•  Consumer	
  
–  AMQ-­‐Cons-­‐1-­‐1-­‐queue.proper9es	
  
–  AMQ-­‐Cons-­‐10-­‐1-­‐topic-­‐durable.proper9es	
  
–  AMQ-­‐Cons-­‐10-­‐10-­‐queue.proper9es	
  
user@computer mvn activemq-perf:producer –Dfactory.brokerURL=tcp://localhost:61616	
user@computer mvn activemq-perf:producer 

–DsysTest.propsConfigFile=AMQ-prod-1-1-queue-persistent.properties
© 2012 FuseSource Corp.All rights reserved.23	
  
What	
  Broker	
  to	
  Use?	
  
§  Load	
  up	
  an	
  external	
  broker	
  
•  Exis9ng	
  broker	
  
•  No	
  maven	
  access	
  
•  Different	
  machine	
  (good	
  idea!)	
  
§  Load	
  one	
  from	
  the	
  perf	
  module	
  
•  Tests	
  and	
  broker	
  config	
  all	
  in	
  one	
  
•  Simple	
  maven	
  command	
  
user@computer mvn activemq-perf:broker –Durl=tcp://localhost:61616
© 2012 FuseSource Corp.All rights reserved.24	
  
Defaults	
  
§  Overall	
  
•  tp,cpu	
  reports	
  
•  5	
  min	
  
•  30s	
  warm	
  up	
  30s	
  cool	
  down	
  
•  1s	
  sample	
  rate	
  
§  Producer	
  
•  Non-­‐persistent	
  
•  Auto	
  ack	
  
•  1K	
  message	
  size	
  
§  Consumer	
  
•  Non	
  durable	
  subscrip9on	
  
•  Auto	
  ack	
  
•  No	
  tx	
  
© 2012 FuseSource Corp.All rights reserved.25	
   Copyright	
  ©	
  2011	
  	
  Progress	
  Sosware	
  Corpora9on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
   A	
  Progress	
  Sosware	
  Company	
  FuseSource	
  Confiden9al	
  25	
  
Quick	
  Demo!	
  
© 2012 FuseSource Corp.All rights reserved.26	
  
Results	
  explana(on	
  
© 2012 FuseSource Corp.All rights reserved.27	
  
While	
  Running…	
  
§  Use	
  JConsole!	
  
§  A	
  more	
  powerful	
  toolkit?	
  YourKit?	
  
§  Rely	
  on	
  OS	
  monitoring,	
  top,	
  iostat,	
  etc	
  
© 2012 FuseSource Corp.All rights reserved.28	
   Copyright	
  ©	
  2011	
  	
  Progress	
  Sosware	
  Corpora9on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
   A	
  Progress	
  Sosware	
  Company	
  FuseSource	
  Confiden9al	
  28	
  
Tuning	
  Ac(veMQ	
  
© 2012 FuseSource Corp.All rights reserved.29	
  
Approach	
  
§  Know	
  your	
  requirements	
  
§  Use	
  real	
  hardware,	
  real	
  scenarios,	
  real	
  se}ngs	
  
§  Know	
  what	
  config	
  changes	
  do!	
  
§  Tune	
  
§  Run	
  tests	
  
§  Capture	
  results	
  
§  Repeat	
  
§  Change	
  only	
  one	
  se}ng	
  at	
  a	
  9me!	
  
© 2012 FuseSource Corp.All rights reserved.30	
  
Where	
  are	
  the	
  BoPlenecks?	
  
§  Overall	
  system	
  
§  Network	
  latencies	
  
§  Disk	
  IO!	
  
§  Threading	
  overheads	
  
§  JVM	
  op9miza9ons	
  
© 2012 FuseSource Corp.All rights reserved.31	
  
Network	
  
§  Mbits/Gbits	
  per	
  second	
  throughput	
  
§  Topology	
  
• Hops	
  
• Switches	
  
• Routes	
  
• Gateways	
  
§  Firewalls	
  
§  Internal/External	
  clients	
  
© 2012 FuseSource Corp.All rights reserved.32	
  
Disk	
  
§  Read/Write	
  speeds	
  
§  Mechanical	
  vs	
  SSD	
  
§  Shared	
  disks,	
  SAN,	
  NAS,	
  NFS,	
  etc	
  
§  Ac9veMQ	
  DiskBenchmark:	
  
Benchmarking:	
  /Users/cposta/temp/test.dat	
  
Writes:	
  	
  
	
  	
  159232	
  writes	
  of	
  size	
  4096	
  wri6en	
  in	
  10.244	
  seconds.	
  
	
  	
  15543.928	
  writes/second.	
  
	
  	
  60.718468	
  megs/second.	
  
	
  
Sync	
  Writes:	
  	
  
	
  	
  33213	
  writes	
  of	
  size	
  4096	
  wri6en	
  in	
  10.001	
  seconds.	
  
	
  	
  3320.968	
  writes/second.	
  
	
  	
  12.972531	
  megs/second.	
  
	
  
Reads:	
  	
  
	
  	
  5160332	
  reads	
  of	
  size	
  4096	
  read	
  in	
  10.001	
  seconds.	
  
	
  	
  515981.6	
  writes/second.	
  
	
  	
  2015.5531	
  megs/second.	
  
user@computer java -classpath lib/activemq-kahadb-store-5.8.0.jar 	
org.apache.activemq.store.kahadb.disk.util.DiskBenchmark 	
/Users/cposta/temp/test.dat
© 2012 FuseSource Corp.All rights reserved.33	
  
Tune	
  What	
  Needs	
  Tuning!	
  	
  
The following aren’t things you must or need do… 	

they are things to consider and can be worth tuning.	

	

Your	
  specific	
  use	
  cases	
  will	
  illuminate	
  what	
  needs	
  tuning	
  
© 2012 FuseSource Corp.All rights reserved.34	
  
Transport	
  Tuning	
  
§  TCP	
  Tuning	
  
•  Timeouts	
  (Handshake,	
  Teardowns)	
  
•  Conges9on	
  avoidance,	
  sliding	
  windows	
  
•  Send/Receive	
  Buffers!!	
  
•  Default	
  64K,	
  but	
  increase	
  to	
  Bandwidth	
  Delay	
  Product	
  
–  Buffer	
  =	
  Bandwidth	
  *	
  RTT	
  	
  
h6p://www.speedguide.net/bdp.php	
  
–  See	
  h6p://en.wikipedia.org/wiki/TCP_tuning	
  
§  Configure	
  the	
  socket:	
  
§  transport.*	
  
§  socket.*	
  
transportConnector	
  name=openwire	
  	
  
	
  	
  	
  	
  	
  uri=tcp://0.0.0.0:61616?maximumConnec9ons=1000	
  
	
  	
  	
  	
  	
  	
  wireformat.maxFrameSize=104857600transport.socketBufferSize=131072	
  /	
  
© 2012 FuseSource Corp.All rights reserved.35	
  
Transport	
  Tuning…	
  
§  Buffering	
  between	
  Socket	
  and	
  Protocol	
  Codec	
  
§  IOBufferSize	
  
•  Default	
  8k	
  	
  
transportConnector	
  name=openwire	
  	
  
	
  	
  	
  	
  	
  uri=tcp://0.0.0.0:61616?maximumConnec9ons=1000	
  
	
  	
  	
  	
  	
  	
  wireformat.maxFrameSize=104857600transport.ioBufferSize=65536	
  /	
  
© 2012 FuseSource Corp.All rights reserved.36	
  
Wire	
  Format	
  Tuning	
  
§  OpenWire	
  (default	
  protocol)	
  
•  wireFormat.tcpNoDelayEnabled	
  –	
  whether	
  or	
  not	
  to	
  use	
  Nagle’s	
  
batching	
  algorithm	
  (default:	
  true	
  ..that	
  means	
  no	
  Nagle)	
  
•  wireFormat.cacheSize	
  –	
  how	
  many	
  command	
  object	
  constants	
  to	
  
cache	
  (default:	
  1024)	
  
•  wireFormat.cacheEnabled	
  –	
  turn	
  cache	
  on/off	
  (default:	
  true)	
  
•  wireFormat.9ghtEncoding	
  –	
  reduce	
  network	
  load	
  (default:	
  true)	
  
•  wireFormat.maxFrameSize	
  –	
  message	
  sizes	
  (default:	
  
Long.MAX_LONG)	
  
•  wireFormat.maxInac9vityDura9on	
  –	
  monitors	
  period	
  of	
  inac9vity	
  
(default:	
  30000ms,	
  set	
  to	
  0	
  to	
  disable))	
  
transportConnector	
  name=openwire	
  	
  
	
  	
  	
  	
  	
  uri=tcp://0.0.0.0:61616?wireFormat.tcpNoDelayEnabled=false	
  /	
  
© 2012 FuseSource Corp.All rights reserved.37	
  
Tuning	
  Clients	
  
§  Compression	
  
•  ?jms.useCompression=true	
  
	
  
•  jms.*	
  configures	
  underlying	
  connec9on	
  factory	
  
•  Uses	
  java.u9l.zip.Deflater	
  
§  Encoding	
  
•  JMS	
  Message	
  types	
  
– Object	
  
– Bytes	
  
– Text	
  
– Stream	
  
– Map	
  
transportConnector	
  name=openwire”	
  uri=tcp://0.0.0.0:61616?jms.useCompression=true	
  /	
  
© 2012 FuseSource Corp.All rights reserved.38	
  
Tuning	
  Producers	
  
§  Producer	
  Flow	
  Control	
  
•  Persistent	
  vs	
  non	
  persistent	
  messaging	
  
•  Broker	
  vs	
  Client	
  
•  Broker	
  memory,	
  client	
  producer	
  window	
  
•  Default	
  sync	
  send	
  for	
  persistent,	
  async	
  send	
  for	
  non-­‐persistent	
  
and	
  transac9ons	
  (except	
  for	
  commit/rollback	
  opera9on)	
  
•  En9re	
  connec9on	
  flow	
  control,	
  individual	
  des9na9on	
  flow	
  control,	
  
TCP	
  flow	
  control	
  	
  
•  Disable	
  flow	
  control	
  
§  jms.alwaysSyncSend	
  
§  jms.useAsyncSend	
  
§  Send	
  fail	
  if	
  no	
  space	
  
policyEntry	
  queue=“queueWildcard”	
  producerFlowControl=“false”	
  /	
  
© 2012 FuseSource Corp.All rights reserved.39	
  
Failover	
  
§  Use	
  failover	
  transport	
  for	
  automa9c	
  reconnects	
  
§  backup	
  
§  priorityBackup	
  
§  trackMessages	
  (default	
  false)	
  
§  backOffMul9plier	
  
§  maxReconnectA6empts	
  
§  randomize	
  
§  Can	
  automa9cally	
  get	
  updates	
  from	
  broker	
  when	
  cluster	
  
situa9on	
  changes	
  
failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false	
  
© 2012 FuseSource Corp.All rights reserved.40	
  
Other	
  Producer	
  Parameters 	
  	
  
§  jms.watchTopicAdvisories=false	
  
§  jms.copyMessageOnSend	
  
§  Batch	
  using	
  transac9ons	
  
© 2012 FuseSource Corp.All rights reserved.41	
  
Tuning	
  Consumers	
  
§  Prefetch	
  
•  Queue	
  –	
  1000	
  
•  Queue	
  Browser	
  –	
  500	
  
•  Topic	
  –	
  32K	
  
•  Durable	
  Topic	
  –	
  100	
  
§  Broker	
  side	
  memory	
  
§  Client	
  side	
  memory	
  
§  Consumer	
  starva9on	
  
© 2012 FuseSource Corp.All rights reserved.42	
  
Prefetch	
  SeXngs	
  
§  Broker	
  
§  Consumer	
  
§  Des9na9on	
  
	
  broker	
  ...	
  	
  
	
  	
  	
  des9na9onPolicy	
  
	
  	
  	
  	
  	
  policyMap	
  
	
  	
  	
  	
  	
  	
  	
  policyEntries	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  policyEntry	
  queue=queue.	
  queuePrefetch=”1”/	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  policyEntry	
  topic=topic.	
  topicPrefetch=”1000”/	
  
	
  	
  	
  	
  	
  	
  	
  /policyEntries	
  
	
  	
  	
  	
  	
  /policyMap	
  
	
  	
  	
  /des9na9onPolicy	
  
	
  /broker	
  
jms.prefetchPolicy.queuePrefetch=100	
  
new	
  Ac9veMQQueue(TEST.QUEUE?consumer.prefetchSize=10)	
  
© 2012 FuseSource Corp.All rights reserved.43	
  
Consumer	
  ACK	
  Modes	
  
§  Session.AUTO_ACKNOWLEDGE	
  
§  Session.CLIENT_ACKNOWLEDGE	
  
§  Session.DUPS_OKAY_ACKNOWLEDGE	
  
§  Session.SESSION_TRANSACTED	
  
§  Ac9veMQSession.INDIVIDUAL_ACKNOWLEDGE	
  
§  jms.op9mizedAcknowledge	
  with	
  AUTO_ACK	
  
§  Note	
  the	
  differences	
  with	
  DUPS_OKAY_ACKNOWLEDGE	
  
when	
  using	
  topics	
  or	
  queues.	
  	
  
© 2012 FuseSource Corp.All rights reserved.44	
  
Other	
  Consumer	
  Parameters	
  
§  jms.alwaysSessionAsync	
  reduce	
  context	
  switching	
  
§  MessageListener	
  faster	
  
§  Spring	
  DMLC:	
  Cache	
  consumers	
  and	
  connec9ons!	
  
© 2012 FuseSource Corp.All rights reserved.45	
  
Tuning	
  Broker	
  Core	
  
§  Keep	
  an	
  eye	
  on	
  number	
  of	
  threads	
  
•  UseDedicatedTaskRunner	
  –	
  use	
  a	
  dedicated	
  dispatch	
  thread	
  for	
  
queues	
  
•  op9mizedDispatch	
  –	
  don’t	
  take	
  the	
  penalty	
  of	
  context	
  switch,	
  just	
  
let	
  the	
  transport	
  thread	
  do	
  the	
  dispatch	
  
•  asyncDispatch	
  –	
  don’t	
  take	
  the	
  penalty	
  of	
  context	
  switch,	
  let	
  the	
  
dispatching	
  thread	
  send	
  to	
  the	
  consumer’s	
  transport	
  
•  NIO	
  connector	
  nio://localhost:61616	
  
© 2012 FuseSource Corp.All rights reserved.46	
  
Broker	
  Resource	
  SeXngs	
  
§  MemoryUsage	
  se}ngs	
  for	
  messages	
  
§  Caching	
  for	
  persistent	
  vs	
  non-­‐persistent	
  
§  Policy	
  se}ngs,	
  memory	
  limits	
  for	
  des9na9ons,	
  cursor	
  high	
  
water	
  mark,	
  etc	
  
§  Temp	
  usage	
  for	
  offlining	
  non-­‐persistent	
  messages	
  
§  Use	
  the	
  right	
  combina9on	
  of	
  memory,	
  producer	
  flow	
  
control,	
  and	
  message	
  cursors	
  
© 2012 FuseSource Corp.All rights reserved.47	
  
Configura(on	
  of	
  Resources	
  
!–	
  defaults	
  -­‐-­‐	
  
systemUsage	
  
	
  	
  systemUsage	
  
	
  	
  	
  	
  memoryUsage	
  
	
  	
  	
  	
  	
  	
  memoryUsage	
  limit=64	
  mb	
  /	
  
	
  	
  	
  	
  /memoryUsage	
  
	
  	
  	
  	
  storeUsage	
  
	
  	
  	
  	
  	
  	
  storeUsage	
  limit=100	
  gb	
  /	
  
	
  	
  	
  	
  /storeUsage	
  
	
  	
  	
  	
  tempUsage	
  
	
  	
  	
  	
  	
  	
  tempUsage	
  limit=10	
  gb	
  /	
  
	
  	
  	
  	
  /tempUsage	
  
	
  	
  /systemUsage	
  
/systemUsage	
  
policyEntry	
  queue=“queueWildcard”	
  memoryLimit=“10M”	
  /	
  
© 2012 FuseSource Corp.All rights reserved.48	
  
KahaDB	
  
§  Current	
  messaging	
  database	
  
§  Fast,	
  op9mized	
  for	
  messaging	
  
§  Journal	
  +	
  Index	
  +	
  write	
  ahead	
  log	
  
§  Fast	
  recovery	
  
§  Fewer	
  file	
  descriptors	
  
© 2012 FuseSource Corp.All rights reserved.49	
  
Tuning	
  KahaDB	
  
§  What	
  levels	
  of	
  reliability	
  must	
  you	
  have?	
  
§  Durability	
  vs	
  throughput	
  
§  fsync	
  vs	
  fflush	
  
§  Areas	
  of	
  tuning	
  
•  Concurrent	
  store	
  and	
  dispatch	
  
•  Index	
  paging,	
  caching,	
  page	
  size,	
  sync,	
  checkpoin9ng	
  
•  Journal	
  sync,	
  file	
  length,	
  checkpoin9ng	
  
© 2012 FuseSource Corp.All rights reserved.50	
  
KahaDB	
  Journal	
  SeXngs	
  
§  enableJournalDiskSyncs	
  (default:	
  true)	
  
§  cleanupInterval	
  (default:	
  30000ms)	
  
§  checkForCorruptJournalFiles	
  (default:	
  false)	
  
§  journalSize	
  (default:	
  32MB)	
  
broker	
  brokerName=broker	
  ...	
  	
  
	
  	
  	
  	
  persistenceAdapter	
  
	
  	
  	
  	
  	
  	
  kahaDB	
  directory=ac9vemq-­‐data	
  journalMaxFileLength=32mb”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  cleanupInterval=“150000”	
  checkForCorruptJournalFiles=“true”/	
  
	
  	
  	
  	
  /persistenceAdapter	
  
	
  	
  	
  	
  ...	
  
	
  	
  /broker	
  
© 2012 FuseSource Corp.All rights reserved.51	
  
KahaDB	
  Index	
  SeXngs	
  
§  How	
  osen	
  the	
  index	
  writes	
  updates	
  
•  checkpointInterval	
  (default:	
  5000),	
  indexWriteBatchSize	
  (default:	
  
1000)	
  
•  Can	
  amor9ze	
  cost	
  across	
  small	
  writes?	
  Or	
  batch	
  them	
  up	
  for	
  
larger	
  writes	
  
§  Size	
  of	
  the	
  index	
  in	
  memory	
  
•  indexCacheSize	
  (default:	
  10000)	
  
§  Sync	
  to	
  disk	
  
•  enableIndexDiskSyncs	
  (default:	
  true)	
  
broker	
  brokerName=broker	
  ...	
  	
  
	
  	
  	
  	
  persistenceAdapter	
  
	
  	
  	
  	
  	
  	
  kahaDB	
  directory=ac9vemq-­‐data	
  journalMaxFileLength=32mb”	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  indexCacheSize=“40000”	
  enableIndexDiskSyncs=“false”/	
  
	
  	
  	
  	
  /persistenceAdapter	
  
	
  	
  	
  	
  ...	
  
	
  	
  /broker	
  
© 2012 FuseSource Corp.All rights reserved.52	
  
Tradeoffs	
  
§  Point	
  to	
  point,	
  publish	
  subscribe	
  
§  Levels	
  of	
  durability	
  
§  Duplicate	
  messages	
  
§  Security	
  
§  Throughput	
  
§  Priority	
  
© 2012 FuseSource Corp.All rights reserved.53	
  
Summary	
  
§  Ac9veMQ	
  is	
  a	
  highly	
  tunable,	
  configurable	
  piece	
  of	
  server	
  
sosware	
  
§  Know	
  your	
  use	
  cases	
  and	
  requirements	
  
§  Use	
  tools	
  to	
  not	
  only	
  load	
  the	
  broker,	
  but	
  monitor	
  the	
  
bo6lenecks	
  
§  Tune	
  for	
  producers/consumers,	
  broker	
  core,	
  network,	
  and	
  
disk	
  IO	
  
§  Ask	
  the	
  computer!	
  
© 2012 FuseSource Corp.All rights reserved.54	
   Copyright	
  ©	
  2011	
  	
  Progress	
  Sosware	
  Corpora9on	
  and/or	
  its	
  subsidiaries	
  or	
  affiliates.	
  All	
  rights	
  reserved.	
  	
   A	
  Progress	
  Sosware	
  Company	
  FuseSource	
  Confiden9al	
  54	
  
Ques(ons?	
  
© 2012 FuseSource Corp.All rights reserved.55	
  
Useful	
  Links	
  
§  Apache	
  Ac9veMQ	
  
h6p://ac9vemq.apache.org/	
  
§  JMS	
  Benchmarks	
  
h6p://github.com/chirino/jms-­‐benchmark	
  
§  Ac9veMQ	
  Performance	
  module	
  tools:
h6p://svn.apache.org/repos/asf/ac9vemq/sandbox/
ac9vemq-­‐persest	
  
	
  
§  Lots	
  of	
  blogging	
  about	
  Ac9veMQ	
  J	
  
h6p://chris9anposta.com/blog	
  
	
  
	
  
1 of 55

Recommended

Ash masters : advanced ash analytics on Oracle by
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Kyle Hailey
2.4K views127 slides
Oracle RAC features on Exadata by
Oracle RAC features on ExadataOracle RAC features on Exadata
Oracle RAC features on ExadataAnil Nair
6.7K views54 slides
Tomcat 마이그레이션 도전하기 (Jins Choi) by
Tomcat 마이그레이션 도전하기 (Jins Choi)Tomcat 마이그레이션 도전하기 (Jins Choi)
Tomcat 마이그레이션 도전하기 (Jins Choi)삵 (sarc.io)
2.2K views26 slides
Oracle GoldenGate アーキテクチャと基本機能 by
Oracle GoldenGate アーキテクチャと基本機能Oracle GoldenGate アーキテクチャと基本機能
Oracle GoldenGate アーキテクチャと基本機能オラクルエンジニア通信
8.2K views54 slides
Best Practices for Middleware and Integration Architecture Modernization with... by
Best Practices for Middleware and Integration Architecture Modernization with...Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...Claus Ibsen
1.5K views71 slides
Airflow and supervisor by
Airflow and supervisorAirflow and supervisor
Airflow and supervisorRafael Roman Otero
343 views35 slides

More Related Content

What's hot

Performance Stability, Tips and Tricks and Underscores by
Performance Stability, Tips and Tricks and UnderscoresPerformance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresJitendra Singh
587 views77 slides
Oracle RAC 19c: Best Practices and Secret Internals by
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
9.5K views47 slides
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdf by
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdfOracle_Multitenant_19c_-_All_About_Pluggable_D.pdf
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdfSrirakshaSrinivasan2
62 views67 slides
Understanding oracle rac internals part 2 - slides by
Understanding oracle rac internals   part 2 - slidesUnderstanding oracle rac internals   part 2 - slides
Understanding oracle rac internals part 2 - slidesMohamed Farouk
1.9K views54 slides
Oracle RAC 19c and Later - Best Practices #OOWLON by
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONMarkus Michalewicz
2.9K views32 slides
Nginx Reverse Proxy with Kafka.pptx by
Nginx Reverse Proxy with Kafka.pptxNginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptxwonyong hwang
469 views14 slides

What's hot(20)

Performance Stability, Tips and Tricks and Underscores by Jitendra Singh
Performance Stability, Tips and Tricks and UnderscoresPerformance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and Underscores
Jitendra Singh587 views
Oracle RAC 19c: Best Practices and Secret Internals by Anil Nair
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
Anil Nair9.5K views
Understanding oracle rac internals part 2 - slides by Mohamed Farouk
Understanding oracle rac internals   part 2 - slidesUnderstanding oracle rac internals   part 2 - slides
Understanding oracle rac internals part 2 - slides
Mohamed Farouk1.9K views
Oracle RAC 19c and Later - Best Practices #OOWLON by Markus Michalewicz
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLON
Markus Michalewicz2.9K views
Nginx Reverse Proxy with Kafka.pptx by wonyong hwang
Nginx Reverse Proxy with Kafka.pptxNginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptx
wonyong hwang469 views
[C13] フラッシュドライブで挑むOracle超高速化と信頼性の両立 by Masashi Fukui by Insight Technology, Inc.
[C13] フラッシュドライブで挑むOracle超高速化と信頼性の両立 by Masashi Fukui[C13] フラッシュドライブで挑むOracle超高速化と信頼性の両立 by Masashi Fukui
[C13] フラッシュドライブで挑むOracle超高速化と信頼性の両立 by Masashi Fukui
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) by Mydbops
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Mydbops2.5K views
SQL Monitoring in Oracle Database 12c by Tanel Poder
SQL Monitoring in Oracle Database 12cSQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12c
Tanel Poder84.7K views
Monitoring using Prometheus and Grafana by Arvind Kumar G.S
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
Arvind Kumar G.S3.5K views
Stream processing using Kafka by Knoldus Inc.
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
Knoldus Inc.1.6K views
Hadoop Query Performance Smackdown by DataWorks Summit
Hadoop Query Performance SmackdownHadoop Query Performance Smackdown
Hadoop Query Performance Smackdown
DataWorks Summit2.6K views
Extreme Replication - Performance Tuning Oracle GoldenGate by Bobby Curtis
Extreme Replication - Performance Tuning Oracle GoldenGateExtreme Replication - Performance Tuning Oracle GoldenGate
Extreme Replication - Performance Tuning Oracle GoldenGate
Bobby Curtis9.8K views
Secured (Kerberos-based) Spark Notebook for Data Science: Spark Summit East t... by Spark Summit
Secured (Kerberos-based) Spark Notebook for Data Science: Spark Summit East t...Secured (Kerberos-based) Spark Notebook for Data Science: Spark Summit East t...
Secured (Kerberos-based) Spark Notebook for Data Science: Spark Summit East t...
Spark Summit4.4K views
From Zero to Hero with Kafka Connect by confluent
From Zero to Hero with Kafka ConnectFrom Zero to Hero with Kafka Connect
From Zero to Hero with Kafka Connect
confluent9.1K views
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ... by StreamNative
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
StreamNative77 views
Developing Microservices with Apache Camel by Claus Ibsen
Developing Microservices with Apache CamelDeveloping Microservices with Apache Camel
Developing Microservices with Apache Camel
Claus Ibsen6.8K views
Introduction to Prometheus by Julien Pivotto
Introduction to PrometheusIntroduction to Prometheus
Introduction to Prometheus
Julien Pivotto6.7K views
Pacemakerを使いこなそう by Takatoshi Matsuo
Pacemakerを使いこなそうPacemakerを使いこなそう
Pacemakerを使いこなそう
Takatoshi Matsuo14.7K views

Similar to ActiveMQ Performance Tuning

Experiences of SOACS by
Experiences of SOACSExperiences of SOACS
Experiences of SOACSSimon Haslam
563 views54 slides
Using Databases and Containers From Development to Deployment by
Using Databases and Containers  From Development to DeploymentUsing Databases and Containers  From Development to Deployment
Using Databases and Containers From Development to DeploymentAerospike, Inc.
1.8K views42 slides
Nebulaworks Docker Overview 09-22-2015 by
Nebulaworks Docker Overview 09-22-2015Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015Chris Ciborowski
3.9K views39 slides
Flume and HBase by
Flume and HBase Flume and HBase
Flume and HBase Alexander Alten-Lorenz
4.4K views12 slides
SD Times - Docker v2 by
SD Times - Docker v2SD Times - Docker v2
SD Times - Docker v2Alvin Richards
123 views42 slides
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups by
MuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys MeetupsMuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys Meetups
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys MeetupsAngel Alberici
740 views43 slides

Similar to ActiveMQ Performance Tuning(20)

Experiences of SOACS by Simon Haslam
Experiences of SOACSExperiences of SOACS
Experiences of SOACS
Simon Haslam563 views
Using Databases and Containers From Development to Deployment by Aerospike, Inc.
Using Databases and Containers  From Development to DeploymentUsing Databases and Containers  From Development to Deployment
Using Databases and Containers From Development to Deployment
Aerospike, Inc. 1.8K views
Nebulaworks Docker Overview 09-22-2015 by Chris Ciborowski
Nebulaworks Docker Overview 09-22-2015Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015
Chris Ciborowski3.9K views
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups by Angel Alberici
MuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys MeetupsMuleSoft Runtime Fabric (RTF): Foundations  : MuleSoft Virtual Muleys Meetups
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups
Angel Alberici740 views
OpenStack + Cloud Foundry for the OpenStack Boston Meetup by ragss
OpenStack + Cloud Foundry for the OpenStack Boston MeetupOpenStack + Cloud Foundry for the OpenStack Boston Meetup
OpenStack + Cloud Foundry for the OpenStack Boston Meetup
ragss731 views
Scaling AEM (CQ5) Gem Session by Michael Marth
Scaling AEM (CQ5) Gem SessionScaling AEM (CQ5) Gem Session
Scaling AEM (CQ5) Gem Session
Michael Marth6.4K views
3 Ways to Connect to the Oracle Cloud by Simon Haslam
3 Ways to Connect to the Oracle Cloud3 Ways to Connect to the Oracle Cloud
3 Ways to Connect to the Oracle Cloud
Simon Haslam2.5K views
EMC World 2016 - code.09 Introduction to the Docker Platform by {code}
EMC World 2016 - code.09 Introduction to the Docker PlatformEMC World 2016 - code.09 Introduction to the Docker Platform
EMC World 2016 - code.09 Introduction to the Docker Platform
{code} 575 views
Hadoop Operations for Production Systems (Strata NYC) by Kathleen Ting
Hadoop Operations for Production Systems (Strata NYC)Hadoop Operations for Production Systems (Strata NYC)
Hadoop Operations for Production Systems (Strata NYC)
Kathleen Ting1.1K views
GlassFish in Production Environments by Bruno Borges
GlassFish in Production EnvironmentsGlassFish in Production Environments
GlassFish in Production Environments
Bruno Borges9.7K views
Distributed application usecase on docker by Hiroshi Miura
Distributed application usecase on dockerDistributed application usecase on docker
Distributed application usecase on docker
Hiroshi Miura345 views
EMC World 2016 - code.15 Better Together: Scale-Out Databases on Scale-Out St... by {code}
EMC World 2016 - code.15 Better Together: Scale-Out Databases on Scale-Out St...EMC World 2016 - code.15 Better Together: Scale-Out Databases on Scale-Out St...
EMC World 2016 - code.15 Better Together: Scale-Out Databases on Scale-Out St...
{code} 897 views
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms by FIWARE
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE192 views
Fine-Tuning of Agile Development by Thoughtworks
Fine-Tuning of Agile DevelopmentFine-Tuning of Agile Development
Fine-Tuning of Agile Development
Thoughtworks3.8K views
Brian Bulkowski : what startups can learn from real-time bidding by Aerospike
Brian Bulkowski : what startups can learn from real-time biddingBrian Bulkowski : what startups can learn from real-time bidding
Brian Bulkowski : what startups can learn from real-time bidding
Aerospike2.1K views

More from Christian Posta

Understanding Wireguard, TLS and Workload Identity by
Understanding Wireguard, TLS and Workload IdentityUnderstanding Wireguard, TLS and Workload Identity
Understanding Wireguard, TLS and Workload IdentityChristian Posta
262 views51 slides
Compliance and Zero Trust Ambient Mesh by
Compliance and Zero Trust Ambient MeshCompliance and Zero Trust Ambient Mesh
Compliance and Zero Trust Ambient MeshChristian Posta
143 views40 slides
Cilium + Istio with Gloo Mesh by
Cilium + Istio with Gloo MeshCilium + Istio with Gloo Mesh
Cilium + Istio with Gloo MeshChristian Posta
597 views40 slides
Multi-cluster service mesh with GlooMesh by
Multi-cluster service mesh with GlooMeshMulti-cluster service mesh with GlooMesh
Multi-cluster service mesh with GlooMeshChristian Posta
1.2K views28 slides
Multicluster Kubernetes and Service Mesh Patterns by
Multicluster Kubernetes and Service Mesh PatternsMulticluster Kubernetes and Service Mesh Patterns
Multicluster Kubernetes and Service Mesh PatternsChristian Posta
1.4K views43 slides
Cloud-Native Application Debugging with Envoy and Service Mesh by
Cloud-Native Application Debugging with Envoy and Service MeshCloud-Native Application Debugging with Envoy and Service Mesh
Cloud-Native Application Debugging with Envoy and Service MeshChristian Posta
928 views79 slides

More from Christian Posta(20)

Understanding Wireguard, TLS and Workload Identity by Christian Posta
Understanding Wireguard, TLS and Workload IdentityUnderstanding Wireguard, TLS and Workload Identity
Understanding Wireguard, TLS and Workload Identity
Christian Posta262 views
Compliance and Zero Trust Ambient Mesh by Christian Posta
Compliance and Zero Trust Ambient MeshCompliance and Zero Trust Ambient Mesh
Compliance and Zero Trust Ambient Mesh
Christian Posta143 views
Multi-cluster service mesh with GlooMesh by Christian Posta
Multi-cluster service mesh with GlooMeshMulti-cluster service mesh with GlooMesh
Multi-cluster service mesh with GlooMesh
Christian Posta1.2K views
Multicluster Kubernetes and Service Mesh Patterns by Christian Posta
Multicluster Kubernetes and Service Mesh PatternsMulticluster Kubernetes and Service Mesh Patterns
Multicluster Kubernetes and Service Mesh Patterns
Christian Posta1.4K views
Cloud-Native Application Debugging with Envoy and Service Mesh by Christian Posta
Cloud-Native Application Debugging with Envoy and Service MeshCloud-Native Application Debugging with Envoy and Service Mesh
Cloud-Native Application Debugging with Envoy and Service Mesh
Christian Posta928 views
Kubernetes Ingress to Service Mesh (and beyond!) by Christian Posta
Kubernetes Ingress to Service Mesh (and beyond!)Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)
Christian Posta614 views
The Truth About the Service Mesh Data Plane by Christian Posta
The Truth About the Service Mesh Data PlaneThe Truth About the Service Mesh Data Plane
The Truth About the Service Mesh Data Plane
Christian Posta2.6K views
Deep Dive: Building external auth plugins for Gloo Enterprise by Christian Posta
Deep Dive: Building external auth plugins for Gloo EnterpriseDeep Dive: Building external auth plugins for Gloo Enterprise
Deep Dive: Building external auth plugins for Gloo Enterprise
Christian Posta719 views
Role of edge gateways in relation to service mesh adoption by Christian Posta
Role of edge gateways in relation to service mesh adoptionRole of edge gateways in relation to service mesh adoption
Role of edge gateways in relation to service mesh adoption
Christian Posta1.1K views
Navigating the service mesh landscape with Istio, Consul Connect, and Linkerd by Christian Posta
Navigating the service mesh landscape with Istio, Consul Connect, and LinkerdNavigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Navigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Christian Posta5K views
Chaos Debugging for Microservices by Christian Posta
Chaos Debugging for MicroservicesChaos Debugging for Microservices
Chaos Debugging for Microservices
Christian Posta694 views
Leveraging Envoy Proxy and GraphQL to Lower the Risk of Monolith to Microserv... by Christian Posta
Leveraging Envoy Proxy and GraphQL to Lower the Risk of Monolith to Microserv...Leveraging Envoy Proxy and GraphQL to Lower the Risk of Monolith to Microserv...
Leveraging Envoy Proxy and GraphQL to Lower the Risk of Monolith to Microserv...
Christian Posta2.8K views
Service-mesh options with Linkerd, Consul, Istio and AWS AppMesh by Christian Posta
Service-mesh options with Linkerd, Consul, Istio and AWS AppMeshService-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Service-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Christian Posta2.8K views
Intro Istio and what's new Istio 1.1 by Christian Posta
Intro Istio and what's new Istio 1.1Intro Istio and what's new Istio 1.1
Intro Istio and what's new Istio 1.1
Christian Posta852 views
API Gateways are going through an identity crisis by Christian Posta
API Gateways are going through an identity crisisAPI Gateways are going through an identity crisis
API Gateways are going through an identity crisis
Christian Posta1.8K views
KubeCon NA 2018: Evolution of Integration and Microservices with Service Mesh... by Christian Posta
KubeCon NA 2018: Evolution of Integration and Microservices with Service Mesh...KubeCon NA 2018: Evolution of Integration and Microservices with Service Mesh...
KubeCon NA 2018: Evolution of Integration and Microservices with Service Mesh...
Christian Posta1.9K views
PHX DevOps Days: Service Mesh Landscape by Christian Posta
PHX DevOps Days: Service Mesh LandscapePHX DevOps Days: Service Mesh Landscape
PHX DevOps Days: Service Mesh Landscape
Christian Posta736 views
API World: The service-mesh landscape by Christian Posta
API World: The service-mesh landscapeAPI World: The service-mesh landscape
API World: The service-mesh landscape
Christian Posta851 views

Recently uploaded

Transcript: The Details of Description Techniques tips and tangents on altern... by
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...BookNet Canada
130 views15 slides
SAP Automation Using Bar Code and FIORI.pdf by
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdfVirendra Rai, PMP
19 views38 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
17 views1 slide
Roadmap to Become Experts.pptx by
Roadmap to Become Experts.pptxRoadmap to Become Experts.pptx
Roadmap to Become Experts.pptxdscwidyatamanew
11 views45 slides
Tunable Laser (1).pptx by
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptxHajira Mahmood
23 views37 slides
PharoJS - Zürich Smalltalk Group Meetup November 2023 by
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023Noury Bouraqadi
120 views17 slides

Recently uploaded(20)

Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada130 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma17 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi120 views
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... by NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS28 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software225 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 views
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze by NUS-ISS
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng TszeDigital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
NUS-ISS19 views
Black and White Modern Science Presentation.pptx by maryamkhalid2916
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptx
maryamkhalid291614 views
[2023] Putting the R! in R&D.pdf by Eleanor McHugh
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh38 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 views
Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica... by NUS-ISS
Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica...Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica...
Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica...
NUS-ISS16 views
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2216 views
DALI Basics Course 2023 by Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 views
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... by Vadym Kazulkin
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin75 views
Web Dev - 1 PPT.pdf by gdsczhcet
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdf
gdsczhcet55 views

ActiveMQ Performance Tuning

  • 1. © 2012 FuseSource Corp.All rights reserved.1   Apache  Ac(veMQ  Performance  Tuning   Chris(an  Posta Senior  Consultant  and  Architect   Blog:  h6p://chris9anposta.com/blog/   Twi6er:  @chris9anposta   GitHub:  h6ps://github.com/chris9an-­‐posta  
  • 2. © 2012 FuseSource Corp.All rights reserved.2   ceposta     § Chris9an  Posta   §  Blog:  h6p://chris9anposta.com/blog/   §  Email:  ceposta@apache.org   §  Twi6er:  @chris9anposta   §  GitHub:  h6ps://github.com/chris9an-­‐posta   §  Goolge+:  h6ps://plus.google.com/103810850748178017238       § Senior  Consultant  and  Architect  at  Red  Hat  (formerly   FuseSource)   § Commi6er  on:  Ac9veMQ,  Apollo   § Author  of  Essen%al  Camel  Components  DZone  Refcard  
  • 3. © 2012 FuseSource Corp.All rights reserved.3   What  Am  I  Talking  About?   §  What  is  Ac9veMQ?   §  Performance/Benchmarking  Tools   §  Tuning  
  • 4. © 2012 FuseSource Corp.All rights reserved.4   Apache  Ac(veMQ   §  OpenSource  Messaging  Server   •  Queues,  Topics,  persistent  messaging,  high   availability,  etc   §  Apache  v2.0  License   §  Ac9ve  community,  Mature,  Stable   §  Used  at  top  companies   •  Insurance,  banking,  retail,  ecommerce,  health   care,  avia9on,  shipping,  et.  al!   §  5.8.0  latest  release  
  • 5. © 2012 FuseSource Corp.All rights reserved.5   Apache  Ac(veMQ   §  High  performance   §  High  Availability   §  Light-­‐weight   §  Mul9-­‐protocol   §  JMS  compliant   §  Supported  in  Produc9on  
  • 6. © 2012 FuseSource Corp.All rights reserved.6   Accessible!   §  Java   §  C/C++  h6p://ac9vemq.apache.org/cms/   §  .NET  h6p://ac9vemq.apache.org/nms/   §  PHP   §  Python   §  Ruby   §  PHP   §  JavaScript     §  Telnet!   §  Any  that  can  make  a  TCP  connec9on  and  send  Text!    
  • 7. © 2012 FuseSource Corp.All rights reserved.7   Transports   §  TCP   §  UDP   §  SSL   §  NIO   §  HTTP/s   §  VM   §  WS  (Web  Sockets)   §  WSS  (Secure  Web  Sockets)  
  • 8. © 2012 FuseSource Corp.All rights reserved.8   Wire  Protocols   §  Openwire   h6p://ac9vemq.apache.org/openwire.html   §  Simple  Text  Oriented  Messaging  Protocol   (STOMP)   h6p://stomp.github.io   §  AMQP  1.0   h6p://www.amqp.org/resources/specifica9ons   §  MQTT   h6p://mq6.org   §  HTTP/REST  
  • 9. © 2012 FuseSource Corp.All rights reserved.9   Ac(veMQ  Features   §  Master/Slave  fault  tolerance  and  High  Availability   §  Broker  “networking”  or  clustering   §  Pluggable  persistence  (KahaDB,  LevelDB,  JDBC)   §  Broker  interoperability  (RabbitMQ,  HornetQ,  etc)   §  Virtual  Topics   §  Mirrored  Queues   §  JMX  Monitoring  
  • 10. © 2012 FuseSource Corp.All rights reserved.10   When  to  use  Messaging?   §  Asynchronous  communica9on/integra9on   §  Durability   §  Loose  coupling   §  Heterogenous  integra9on   §  Real-­‐9me  data  
  • 11. © 2012 FuseSource Corp.All rights reserved.11   Configura(on   Ac9veMQ  is  Highly  Configurable!!  
  • 12. © 2012 FuseSource Corp.All rights reserved.12   Performance/Benchmarking   Tools  
  • 13. © 2012 FuseSource Corp.All rights reserved.13   So  What  Are  We  Covering?   §  Tools   §  How  to  approach  performance  tuning   §  Areas  to  tweak!  
  • 14. © 2012 FuseSource Corp.All rights reserved.14   What  are  Your  Objec(ves!?   §  Please,  please,  please..  Know   what  you’re  trying  to   accomplish!   §  Know  your  use  cases!   §  Know  your  hardware/OS   §  Understand  all  of  the  broker   config  changes  you  make!   §  VALIDATE  YOUR  CHANGES!  
  • 15. © 2012 FuseSource Corp.All rights reserved.15   Broker  Benchmarking  Tools   §  Ac9veMQ  Performance  Module   §  jms-­‐benchmark   §  JMSTester   §  Apache  Jmeter   §  Grinder   §  …?  
  • 16. © 2012 FuseSource Corp.All rights reserved.16   Ac(veMQ  Performance  Module   §  Part  of  the  Ac9veMQ  Build   h6p://ac9vemq.apache.org/ac9vemq-­‐performance-­‐module-­‐users-­‐manual.html   §  Maven  plugin   §  Quick  and  easy  to  get  started   §  Flexible   §  Records  throughput,  basic  sta9s9cs,  and  CPU   metrics  
  • 17. © 2012 FuseSource Corp.All rights reserved.17   jms-­‐benchmark   §  Opensource  at  github,  from  Hiram  Chirino h6p://github.com/chirino/jms-­‐benchmark   §  Comprehensive  benchmarks   §  Configurable   §  All-­‐on-­‐one   §  Mul9ple  brokers   §  Pre6y  graphs!  
  • 18. © 2012 FuseSource Corp.All rights reserved.18   JmsTester   §  From  FuseSource     h6p://jmstester.fusesource.org   §  My  branch:   h6ps://github.com/chris9an-­‐posta/jms-­‐tester   §  Allows  more  complicated  load  tes9ng   §  Distributed   §  Records  messaging  throughput  and  CPU,  Memory,   Network  IO,  Disk  IO,  et  al.     §  Thorough  documenta9on     §  My  blog  post:     h6p://www.chris9anposta.com/blog/?p=268  
  • 19. © 2012 FuseSource Corp.All rights reserved.19   JMeter     §  Swiss  army  knife  of  load  tes9ng   §  From  Apache   h6p://jmeter.apache.org   §  JMS,  HTTP,  TCP,  SOAP,  JDBC,    and  many  others   §  Many  aggregators  and  repor9ng  features   §  Mature  product,  well  known  
  • 20. © 2012 FuseSource Corp.All rights reserved.20   OS  Tools   §  Lest  we  forget…  rely  heavily  on  the  tools  your  Opera9ng   System  exposes!   §  Linux   •  top   •  iostat   •  netstat   •  vmstat   §  Windows   •  Built  in  process,  resource  monitors  
  • 21. © 2012 FuseSource Corp.All rights reserved.21   Ac(veMQ  Performance  Module   §  Maven  plugin   §  Can  use  exis9ng  project: h6ps://svn.apache.org/repos/asf/ac9vemq/sandbox/ac9vemq-­‐persest   §  Spin  up  producers,  consumers   §  Control  number  of  threads,  test  dura9ons,  etc   §  Stats  and  Repor9ng   •  Throughput,  min/max,  broken  down  per  client        plugin                    groupIdorg.apache.ac9vemq.tooling/groupId                    ar9factIdac9vemq-­‐perf-­‐maven-­‐plugin/ar9factId                    version${ac9vemq-­‐version}/version    /plugin  
  • 22. © 2012 FuseSource Corp.All rights reserved.22   Using  Performance  Module   §  Example:   §  Out  of  the  box  examples:   §  Other  out  of  the  box  profiles:   •  Producer   –  AMQ-­‐Prod-­‐1-­‐1-­‐queue-­‐nonpersistent.proper9es   –  AMQ-­‐Prod-­‐10-­‐1-­‐queue-­‐nonpersistent.proper9es   –  AMQ-­‐Prod-­‐10-­‐10-­‐topic-­‐persistent.proper9es   •  Consumer   –  AMQ-­‐Cons-­‐1-­‐1-­‐queue.proper9es   –  AMQ-­‐Cons-­‐10-­‐1-­‐topic-­‐durable.proper9es   –  AMQ-­‐Cons-­‐10-­‐10-­‐queue.proper9es   user@computer mvn activemq-perf:producer –Dfactory.brokerURL=tcp://localhost:61616 user@computer mvn activemq-perf:producer 
 –DsysTest.propsConfigFile=AMQ-prod-1-1-queue-persistent.properties
  • 23. © 2012 FuseSource Corp.All rights reserved.23   What  Broker  to  Use?   §  Load  up  an  external  broker   •  Exis9ng  broker   •  No  maven  access   •  Different  machine  (good  idea!)   §  Load  one  from  the  perf  module   •  Tests  and  broker  config  all  in  one   •  Simple  maven  command   user@computer mvn activemq-perf:broker –Durl=tcp://localhost:61616
  • 24. © 2012 FuseSource Corp.All rights reserved.24   Defaults   §  Overall   •  tp,cpu  reports   •  5  min   •  30s  warm  up  30s  cool  down   •  1s  sample  rate   §  Producer   •  Non-­‐persistent   •  Auto  ack   •  1K  message  size   §  Consumer   •  Non  durable  subscrip9on   •  Auto  ack   •  No  tx  
  • 25. © 2012 FuseSource Corp.All rights reserved.25   Copyright  ©  2011    Progress  Sosware  Corpora9on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  Sosware  Company  FuseSource  Confiden9al  25   Quick  Demo!  
  • 26. © 2012 FuseSource Corp.All rights reserved.26   Results  explana(on  
  • 27. © 2012 FuseSource Corp.All rights reserved.27   While  Running…   §  Use  JConsole!   §  A  more  powerful  toolkit?  YourKit?   §  Rely  on  OS  monitoring,  top,  iostat,  etc  
  • 28. © 2012 FuseSource Corp.All rights reserved.28   Copyright  ©  2011    Progress  Sosware  Corpora9on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  Sosware  Company  FuseSource  Confiden9al  28   Tuning  Ac(veMQ  
  • 29. © 2012 FuseSource Corp.All rights reserved.29   Approach   §  Know  your  requirements   §  Use  real  hardware,  real  scenarios,  real  se}ngs   §  Know  what  config  changes  do!   §  Tune   §  Run  tests   §  Capture  results   §  Repeat   §  Change  only  one  se}ng  at  a  9me!  
  • 30. © 2012 FuseSource Corp.All rights reserved.30   Where  are  the  BoPlenecks?   §  Overall  system   §  Network  latencies   §  Disk  IO!   §  Threading  overheads   §  JVM  op9miza9ons  
  • 31. © 2012 FuseSource Corp.All rights reserved.31   Network   §  Mbits/Gbits  per  second  throughput   §  Topology   • Hops   • Switches   • Routes   • Gateways   §  Firewalls   §  Internal/External  clients  
  • 32. © 2012 FuseSource Corp.All rights reserved.32   Disk   §  Read/Write  speeds   §  Mechanical  vs  SSD   §  Shared  disks,  SAN,  NAS,  NFS,  etc   §  Ac9veMQ  DiskBenchmark:   Benchmarking:  /Users/cposta/temp/test.dat   Writes:        159232  writes  of  size  4096  wri6en  in  10.244  seconds.      15543.928  writes/second.      60.718468  megs/second.     Sync  Writes:        33213  writes  of  size  4096  wri6en  in  10.001  seconds.      3320.968  writes/second.      12.972531  megs/second.     Reads:        5160332  reads  of  size  4096  read  in  10.001  seconds.      515981.6  writes/second.      2015.5531  megs/second.   user@computer java -classpath lib/activemq-kahadb-store-5.8.0.jar org.apache.activemq.store.kahadb.disk.util.DiskBenchmark /Users/cposta/temp/test.dat
  • 33. © 2012 FuseSource Corp.All rights reserved.33   Tune  What  Needs  Tuning!     The following aren’t things you must or need do… they are things to consider and can be worth tuning. Your  specific  use  cases  will  illuminate  what  needs  tuning  
  • 34. © 2012 FuseSource Corp.All rights reserved.34   Transport  Tuning   §  TCP  Tuning   •  Timeouts  (Handshake,  Teardowns)   •  Conges9on  avoidance,  sliding  windows   •  Send/Receive  Buffers!!   •  Default  64K,  but  increase  to  Bandwidth  Delay  Product   –  Buffer  =  Bandwidth  *  RTT     h6p://www.speedguide.net/bdp.php   –  See  h6p://en.wikipedia.org/wiki/TCP_tuning   §  Configure  the  socket:   §  transport.*   §  socket.*   transportConnector  name=openwire              uri=tcp://0.0.0.0:61616?maximumConnec9ons=1000              wireformat.maxFrameSize=104857600transport.socketBufferSize=131072  /  
  • 35. © 2012 FuseSource Corp.All rights reserved.35   Transport  Tuning…   §  Buffering  between  Socket  and  Protocol  Codec   §  IOBufferSize   •  Default  8k     transportConnector  name=openwire              uri=tcp://0.0.0.0:61616?maximumConnec9ons=1000              wireformat.maxFrameSize=104857600transport.ioBufferSize=65536  /  
  • 36. © 2012 FuseSource Corp.All rights reserved.36   Wire  Format  Tuning   §  OpenWire  (default  protocol)   •  wireFormat.tcpNoDelayEnabled  –  whether  or  not  to  use  Nagle’s   batching  algorithm  (default:  true  ..that  means  no  Nagle)   •  wireFormat.cacheSize  –  how  many  command  object  constants  to   cache  (default:  1024)   •  wireFormat.cacheEnabled  –  turn  cache  on/off  (default:  true)   •  wireFormat.9ghtEncoding  –  reduce  network  load  (default:  true)   •  wireFormat.maxFrameSize  –  message  sizes  (default:   Long.MAX_LONG)   •  wireFormat.maxInac9vityDura9on  –  monitors  period  of  inac9vity   (default:  30000ms,  set  to  0  to  disable))   transportConnector  name=openwire              uri=tcp://0.0.0.0:61616?wireFormat.tcpNoDelayEnabled=false  /  
  • 37. © 2012 FuseSource Corp.All rights reserved.37   Tuning  Clients   §  Compression   •  ?jms.useCompression=true     •  jms.*  configures  underlying  connec9on  factory   •  Uses  java.u9l.zip.Deflater   §  Encoding   •  JMS  Message  types   – Object   – Bytes   – Text   – Stream   – Map   transportConnector  name=openwire”  uri=tcp://0.0.0.0:61616?jms.useCompression=true  /  
  • 38. © 2012 FuseSource Corp.All rights reserved.38   Tuning  Producers   §  Producer  Flow  Control   •  Persistent  vs  non  persistent  messaging   •  Broker  vs  Client   •  Broker  memory,  client  producer  window   •  Default  sync  send  for  persistent,  async  send  for  non-­‐persistent   and  transac9ons  (except  for  commit/rollback  opera9on)   •  En9re  connec9on  flow  control,  individual  des9na9on  flow  control,   TCP  flow  control     •  Disable  flow  control   §  jms.alwaysSyncSend   §  jms.useAsyncSend   §  Send  fail  if  no  space   policyEntry  queue=“queueWildcard”  producerFlowControl=“false”  /  
  • 39. © 2012 FuseSource Corp.All rights reserved.39   Failover   §  Use  failover  transport  for  automa9c  reconnects   §  backup   §  priorityBackup   §  trackMessages  (default  false)   §  backOffMul9plier   §  maxReconnectA6empts   §  randomize   §  Can  automa9cally  get  updates  from  broker  when  cluster   situa9on  changes   failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false  
  • 40. © 2012 FuseSource Corp.All rights reserved.40   Other  Producer  Parameters     §  jms.watchTopicAdvisories=false   §  jms.copyMessageOnSend   §  Batch  using  transac9ons  
  • 41. © 2012 FuseSource Corp.All rights reserved.41   Tuning  Consumers   §  Prefetch   •  Queue  –  1000   •  Queue  Browser  –  500   •  Topic  –  32K   •  Durable  Topic  –  100   §  Broker  side  memory   §  Client  side  memory   §  Consumer  starva9on  
  • 42. © 2012 FuseSource Corp.All rights reserved.42   Prefetch  SeXngs   §  Broker   §  Consumer   §  Des9na9on    broker  ...          des9na9onPolicy            policyMap                policyEntries                    policyEntry  queue=queue.  queuePrefetch=”1”/                    policyEntry  topic=topic.  topicPrefetch=”1000”/                /policyEntries            /policyMap        /des9na9onPolicy    /broker   jms.prefetchPolicy.queuePrefetch=100   new  Ac9veMQQueue(TEST.QUEUE?consumer.prefetchSize=10)  
  • 43. © 2012 FuseSource Corp.All rights reserved.43   Consumer  ACK  Modes   §  Session.AUTO_ACKNOWLEDGE   §  Session.CLIENT_ACKNOWLEDGE   §  Session.DUPS_OKAY_ACKNOWLEDGE   §  Session.SESSION_TRANSACTED   §  Ac9veMQSession.INDIVIDUAL_ACKNOWLEDGE   §  jms.op9mizedAcknowledge  with  AUTO_ACK   §  Note  the  differences  with  DUPS_OKAY_ACKNOWLEDGE   when  using  topics  or  queues.    
  • 44. © 2012 FuseSource Corp.All rights reserved.44   Other  Consumer  Parameters   §  jms.alwaysSessionAsync  reduce  context  switching   §  MessageListener  faster   §  Spring  DMLC:  Cache  consumers  and  connec9ons!  
  • 45. © 2012 FuseSource Corp.All rights reserved.45   Tuning  Broker  Core   §  Keep  an  eye  on  number  of  threads   •  UseDedicatedTaskRunner  –  use  a  dedicated  dispatch  thread  for   queues   •  op9mizedDispatch  –  don’t  take  the  penalty  of  context  switch,  just   let  the  transport  thread  do  the  dispatch   •  asyncDispatch  –  don’t  take  the  penalty  of  context  switch,  let  the   dispatching  thread  send  to  the  consumer’s  transport   •  NIO  connector  nio://localhost:61616  
  • 46. © 2012 FuseSource Corp.All rights reserved.46   Broker  Resource  SeXngs   §  MemoryUsage  se}ngs  for  messages   §  Caching  for  persistent  vs  non-­‐persistent   §  Policy  se}ngs,  memory  limits  for  des9na9ons,  cursor  high   water  mark,  etc   §  Temp  usage  for  offlining  non-­‐persistent  messages   §  Use  the  right  combina9on  of  memory,  producer  flow   control,  and  message  cursors  
  • 47. © 2012 FuseSource Corp.All rights reserved.47   Configura(on  of  Resources   !–  defaults  -­‐-­‐   systemUsage      systemUsage          memoryUsage              memoryUsage  limit=64  mb  /          /memoryUsage          storeUsage              storeUsage  limit=100  gb  /          /storeUsage          tempUsage              tempUsage  limit=10  gb  /          /tempUsage      /systemUsage   /systemUsage   policyEntry  queue=“queueWildcard”  memoryLimit=“10M”  /  
  • 48. © 2012 FuseSource Corp.All rights reserved.48   KahaDB   §  Current  messaging  database   §  Fast,  op9mized  for  messaging   §  Journal  +  Index  +  write  ahead  log   §  Fast  recovery   §  Fewer  file  descriptors  
  • 49. © 2012 FuseSource Corp.All rights reserved.49   Tuning  KahaDB   §  What  levels  of  reliability  must  you  have?   §  Durability  vs  throughput   §  fsync  vs  fflush   §  Areas  of  tuning   •  Concurrent  store  and  dispatch   •  Index  paging,  caching,  page  size,  sync,  checkpoin9ng   •  Journal  sync,  file  length,  checkpoin9ng  
  • 50. © 2012 FuseSource Corp.All rights reserved.50   KahaDB  Journal  SeXngs   §  enableJournalDiskSyncs  (default:  true)   §  cleanupInterval  (default:  30000ms)   §  checkForCorruptJournalFiles  (default:  false)   §  journalSize  (default:  32MB)   broker  brokerName=broker  ...            persistenceAdapter              kahaDB  directory=ac9vemq-­‐data  journalMaxFileLength=32mb”                                                    cleanupInterval=“150000”  checkForCorruptJournalFiles=“true”/          /persistenceAdapter          ...      /broker  
  • 51. © 2012 FuseSource Corp.All rights reserved.51   KahaDB  Index  SeXngs   §  How  osen  the  index  writes  updates   •  checkpointInterval  (default:  5000),  indexWriteBatchSize  (default:   1000)   •  Can  amor9ze  cost  across  small  writes?  Or  batch  them  up  for   larger  writes   §  Size  of  the  index  in  memory   •  indexCacheSize  (default:  10000)   §  Sync  to  disk   •  enableIndexDiskSyncs  (default:  true)   broker  brokerName=broker  ...            persistenceAdapter              kahaDB  directory=ac9vemq-­‐data  journalMaxFileLength=32mb”                                                    indexCacheSize=“40000”  enableIndexDiskSyncs=“false”/          /persistenceAdapter          ...      /broker  
  • 52. © 2012 FuseSource Corp.All rights reserved.52   Tradeoffs   §  Point  to  point,  publish  subscribe   §  Levels  of  durability   §  Duplicate  messages   §  Security   §  Throughput   §  Priority  
  • 53. © 2012 FuseSource Corp.All rights reserved.53   Summary   §  Ac9veMQ  is  a  highly  tunable,  configurable  piece  of  server   sosware   §  Know  your  use  cases  and  requirements   §  Use  tools  to  not  only  load  the  broker,  but  monitor  the   bo6lenecks   §  Tune  for  producers/consumers,  broker  core,  network,  and   disk  IO   §  Ask  the  computer!  
  • 54. © 2012 FuseSource Corp.All rights reserved.54   Copyright  ©  2011    Progress  Sosware  Corpora9on  and/or  its  subsidiaries  or  affiliates.  All  rights  reserved.     A  Progress  Sosware  Company  FuseSource  Confiden9al  54   Ques(ons?  
  • 55. © 2012 FuseSource Corp.All rights reserved.55   Useful  Links   §  Apache  Ac9veMQ   h6p://ac9vemq.apache.org/   §  JMS  Benchmarks   h6p://github.com/chirino/jms-­‐benchmark   §  Ac9veMQ  Performance  module  tools: h6p://svn.apache.org/repos/asf/ac9vemq/sandbox/ ac9vemq-­‐persest     §  Lots  of  blogging  about  Ac9veMQ  J   h6p://chris9anposta.com/blog