Smart Batching

202 views
Skip to first unread message

James Bunch

unread,
Apr 29, 2014, 10:38:15 AM4/29/14
to akka...@googlegroups.com
Hi All,

Has anyone used Akka to implement something akin to the 'Smart Batching' pattern that Martin Thompson describes in this blog post? 

Which looks to be pretty close, but not quite the same approach - if I'm understanding it correctly!

The use-case I'm interested in is to batch lots of small network calls before they are sent over a high latency link to an external system.

JB

Akka Team

unread,
Apr 29, 2014, 10:44:57 AM4/29/14
to Akka User List
Hi James,

You can achieve something similar with akka.io (http://doc.akka.io/docs/akka/2.3.2/scala/io.html). For example, while your actor waits from an Ack from a corresponding Tcp connection actor, it can batch up the all the incoming ByteStrings and send them off in one piece resulting in one write. I have an implementation of this pattern in the first version of our Tcp stream support but it was not yet measured in any form.

-Endre


--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam

James Bunch

unread,
Apr 30, 2014, 5:13:24 AM4/30/14
to akka...@googlegroups.com
Thanks, that looks useful.

I'm using spray.client at the moment to make the network call (to a web-service). I'm not sure how the akka.io stuff would fit in to this though?

Akka Team

unread,
Apr 30, 2014, 5:44:56 AM4/30/14
to Akka User List
Hi James,

Spray sits on top of akka.io. Unfortunately I don't think you can modify how it talks to the Tcp connection. Anyway, since akka-http will use reactive streams this batching behavior will be used by default. I am not sure how much it will buy though, spray is already pretty fast.

-Endre


On Wed, Apr 30, 2014 at 11:13 AM, James Bunch <james....@gmail.com> wrote:
Thanks, that looks useful.

I'm using spray.client at the moment to make the network call (to a web-service). I'm not sure how the akka.io stuff would fit in to this though?

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

James Bunch

unread,
May 1, 2014, 3:26:56 AM5/1/14
to akka...@googlegroups.com
That's ok. I think I'll try the batching pattern (with max size and max latency constraints) described in https://groups.google.com/forum/#!topic/akka-user/todrna9GRS8/discussion

It seems to improve throughput substantially - in a quick test over a simulated high latency link.

Reply all
Reply to author
Forward
0 new messages