On 08/26/2015 10:46 AM, 'Johannes Rudolph' via Akka User List wrote:
On Wed, Aug 26, 2015 at 2:02 AM, Simon Schäfer <[email protected]> wrote:
The only thing I didn't understand was this part:
Source.actorRef(1, OverflowStrategy.fail)
When I replace the 1 with a 0 (which is allowed according to the
documentation) I get this error message: Dropping element because there is
no downstream demand
Why do I get it? I expected that since there is a client which awaits for
data that I don't need a cache. Maybe it is because the client (connected
over TCP) is not a reactive stream, i.e. didn't tell beforehand that it
awaits data?
If you use `Tcp.outgoingConnection` you get a reactive stream
interface for a TCP connection. On the outgoing stream side it works
like this: whenever there's space in the OS send buffer for the socket
the sink/subscriber part of the flow will tell its publisher that it
needs demand. On a fresh or idle connection this will be the case. So,
I think you are right that a value of `0` could work. However, all
these components are working asynchronously, so you might be running
into a race condition where demand just has not been registered yet.
Ok, good to know. I don't know how to solve the problem for now. I'll
let it bite me in the future.
Anyway, 1 seems to be enough, even for 100s of requests.
Yes, this is possible. Without load on the machine and especially
testing against localhost the kernel send buffers for a socket are
quite big (I forgot about how big exactly, but usually somewhere
between 100kb and 5MB). It is unlikely that you will be able to fill
the socket buffers fast enough. However, there's still the race
condition of demand having to travel fast enough through the
asynchronous stages, so it could also be just luck that it is working
well right now (or it could mean that your current running conditions
are favorable for this case for unknown reason).
Johannes
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.