Akka Streams + Akka Cluster









up vote
2
down vote

favorite












I have a question about the use of Akka Streams and Akka Cluster. I'm trying to make a version of distributed word count using Akka Streams and Akka Cluster.



I would like to build an Akka Streams client that reads a text file as streaming I/O and sends the stream of words to a remote cluster. This is the code of the client:



final Path file = Paths.get("example.txt");
final Source<ByteString, CompletionStage<IOResult>> read = FileIO.fromPath(file);

final Source<Pair<String, Integer>, CompletionStage<IOResult>> counts =
read
.via(Framing.delimiter(ByteString.fromString(" "), 256, FramingTruncation.ALLOW))
.map(i -> i.utf8String())
.runWith(/* send to Akka cluster */);


I don't understand what I have to use to send streaming data to an Akka cluster without losing the bases of Akka Streams (backpressure, etc.).



I know of the existence of Stream refs and Cluster Client but I don't understand which of them to use.










share|improve this question









New contributor




Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • There is a way to integrate actors with akka streams: doc.akka.io/docs/akka/2.5.3/scala/stream/…, though I don't think it's a good idea since, in order to preserve the the back pressure, you have to add a lot of boiler plate across your actors...
    – RoberMP
    Nov 13 at 9:52














up vote
2
down vote

favorite












I have a question about the use of Akka Streams and Akka Cluster. I'm trying to make a version of distributed word count using Akka Streams and Akka Cluster.



I would like to build an Akka Streams client that reads a text file as streaming I/O and sends the stream of words to a remote cluster. This is the code of the client:



final Path file = Paths.get("example.txt");
final Source<ByteString, CompletionStage<IOResult>> read = FileIO.fromPath(file);

final Source<Pair<String, Integer>, CompletionStage<IOResult>> counts =
read
.via(Framing.delimiter(ByteString.fromString(" "), 256, FramingTruncation.ALLOW))
.map(i -> i.utf8String())
.runWith(/* send to Akka cluster */);


I don't understand what I have to use to send streaming data to an Akka cluster without losing the bases of Akka Streams (backpressure, etc.).



I know of the existence of Stream refs and Cluster Client but I don't understand which of them to use.










share|improve this question









New contributor




Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • There is a way to integrate actors with akka streams: doc.akka.io/docs/akka/2.5.3/scala/stream/…, though I don't think it's a good idea since, in order to preserve the the back pressure, you have to add a lot of boiler plate across your actors...
    – RoberMP
    Nov 13 at 9:52












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have a question about the use of Akka Streams and Akka Cluster. I'm trying to make a version of distributed word count using Akka Streams and Akka Cluster.



I would like to build an Akka Streams client that reads a text file as streaming I/O and sends the stream of words to a remote cluster. This is the code of the client:



final Path file = Paths.get("example.txt");
final Source<ByteString, CompletionStage<IOResult>> read = FileIO.fromPath(file);

final Source<Pair<String, Integer>, CompletionStage<IOResult>> counts =
read
.via(Framing.delimiter(ByteString.fromString(" "), 256, FramingTruncation.ALLOW))
.map(i -> i.utf8String())
.runWith(/* send to Akka cluster */);


I don't understand what I have to use to send streaming data to an Akka cluster without losing the bases of Akka Streams (backpressure, etc.).



I know of the existence of Stream refs and Cluster Client but I don't understand which of them to use.










share|improve this question









New contributor




Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have a question about the use of Akka Streams and Akka Cluster. I'm trying to make a version of distributed word count using Akka Streams and Akka Cluster.



I would like to build an Akka Streams client that reads a text file as streaming I/O and sends the stream of words to a remote cluster. This is the code of the client:



final Path file = Paths.get("example.txt");
final Source<ByteString, CompletionStage<IOResult>> read = FileIO.fromPath(file);

final Source<Pair<String, Integer>, CompletionStage<IOResult>> counts =
read
.via(Framing.delimiter(ByteString.fromString(" "), 256, FramingTruncation.ALLOW))
.map(i -> i.utf8String())
.runWith(/* send to Akka cluster */);


I don't understand what I have to use to send streaming data to an Akka cluster without losing the bases of Akka Streams (backpressure, etc.).



I know of the existence of Stream refs and Cluster Client but I don't understand which of them to use.







java akka akka-stream akka-cluster






share|improve this question









New contributor




Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 10 at 19:43









Jeffrey Chung

13.4k62139




13.4k62139






New contributor




Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 10 at 15:43









Alexh2o

112




112




New contributor




Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Alexh2o is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • There is a way to integrate actors with akka streams: doc.akka.io/docs/akka/2.5.3/scala/stream/…, though I don't think it's a good idea since, in order to preserve the the back pressure, you have to add a lot of boiler plate across your actors...
    – RoberMP
    Nov 13 at 9:52
















  • There is a way to integrate actors with akka streams: doc.akka.io/docs/akka/2.5.3/scala/stream/…, though I don't think it's a good idea since, in order to preserve the the back pressure, you have to add a lot of boiler plate across your actors...
    – RoberMP
    Nov 13 at 9:52















There is a way to integrate actors with akka streams: doc.akka.io/docs/akka/2.5.3/scala/stream/…, though I don't think it's a good idea since, in order to preserve the the back pressure, you have to add a lot of boiler plate across your actors...
– RoberMP
Nov 13 at 9:52




There is a way to integrate actors with akka streams: doc.akka.io/docs/akka/2.5.3/scala/stream/…, though I don't think it's a good idea since, in order to preserve the the back pressure, you have to add a lot of boiler plate across your actors...
– RoberMP
Nov 13 at 9:52












2 Answers
2






active

oldest

votes

















up vote
0
down vote













Direct Answer



I don't think the functionality that you are looking for is available as of version 2.5.18. The inventory of cluster functionality doesn't list anything related to streams.



Indirect Answer



The computational requirements for your use case would have to be rather extreme to justify an akka-stream spanning multiple servers. The amount of parallelism available in a single server is rather large given the explosion of core count on modern processors. Therefore, each step of computation in your stream would have to require a huge amount of processor resources to justify spanning the stream across a network.



If you are truly working on such a large project then a tool like apache spark may better suite your needs.






share|improve this answer




















  • I know that this use case doesn't justify the use of akka streams but i worked It as initial parte of my thesis. i use this use case only to start to use akka toolkit. Than I hope to use a more realistic and extreme use case.
    – Alexh2o
    Nov 12 at 14:41

















up vote
0
down vote













I don't think what you are looking for currently exists. However, there is this similar thing called streamRefs which allow you to have reactive streams over the network. Take a look here: https://doc.akka.io/docs/akka/2.5/stream/stream-refs.html






share|improve this answer




















  • I have read about StreamRef but seams to be something to tie two stream over network. Instead i want to tie a single stream to multiple stream on multiple node in a akka cluster. Now i'm using the first stream as publisher and the streams in cluster as consumer with akka Kafka streams but I don't know if It is the best solution
    – Alexh2o
    Nov 12 at 14:45










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Alexh2o is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240558%2fakka-streams-akka-cluster%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Direct Answer



I don't think the functionality that you are looking for is available as of version 2.5.18. The inventory of cluster functionality doesn't list anything related to streams.



Indirect Answer



The computational requirements for your use case would have to be rather extreme to justify an akka-stream spanning multiple servers. The amount of parallelism available in a single server is rather large given the explosion of core count on modern processors. Therefore, each step of computation in your stream would have to require a huge amount of processor resources to justify spanning the stream across a network.



If you are truly working on such a large project then a tool like apache spark may better suite your needs.






share|improve this answer




















  • I know that this use case doesn't justify the use of akka streams but i worked It as initial parte of my thesis. i use this use case only to start to use akka toolkit. Than I hope to use a more realistic and extreme use case.
    – Alexh2o
    Nov 12 at 14:41














up vote
0
down vote













Direct Answer



I don't think the functionality that you are looking for is available as of version 2.5.18. The inventory of cluster functionality doesn't list anything related to streams.



Indirect Answer



The computational requirements for your use case would have to be rather extreme to justify an akka-stream spanning multiple servers. The amount of parallelism available in a single server is rather large given the explosion of core count on modern processors. Therefore, each step of computation in your stream would have to require a huge amount of processor resources to justify spanning the stream across a network.



If you are truly working on such a large project then a tool like apache spark may better suite your needs.






share|improve this answer




















  • I know that this use case doesn't justify the use of akka streams but i worked It as initial parte of my thesis. i use this use case only to start to use akka toolkit. Than I hope to use a more realistic and extreme use case.
    – Alexh2o
    Nov 12 at 14:41












up vote
0
down vote










up vote
0
down vote









Direct Answer



I don't think the functionality that you are looking for is available as of version 2.5.18. The inventory of cluster functionality doesn't list anything related to streams.



Indirect Answer



The computational requirements for your use case would have to be rather extreme to justify an akka-stream spanning multiple servers. The amount of parallelism available in a single server is rather large given the explosion of core count on modern processors. Therefore, each step of computation in your stream would have to require a huge amount of processor resources to justify spanning the stream across a network.



If you are truly working on such a large project then a tool like apache spark may better suite your needs.






share|improve this answer












Direct Answer



I don't think the functionality that you are looking for is available as of version 2.5.18. The inventory of cluster functionality doesn't list anything related to streams.



Indirect Answer



The computational requirements for your use case would have to be rather extreme to justify an akka-stream spanning multiple servers. The amount of parallelism available in a single server is rather large given the explosion of core count on modern processors. Therefore, each step of computation in your stream would have to require a huge amount of processor resources to justify spanning the stream across a network.



If you are truly working on such a large project then a tool like apache spark may better suite your needs.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 13:31









Ramon J Romero y Vigil

11.5k23970




11.5k23970











  • I know that this use case doesn't justify the use of akka streams but i worked It as initial parte of my thesis. i use this use case only to start to use akka toolkit. Than I hope to use a more realistic and extreme use case.
    – Alexh2o
    Nov 12 at 14:41
















  • I know that this use case doesn't justify the use of akka streams but i worked It as initial parte of my thesis. i use this use case only to start to use akka toolkit. Than I hope to use a more realistic and extreme use case.
    – Alexh2o
    Nov 12 at 14:41















I know that this use case doesn't justify the use of akka streams but i worked It as initial parte of my thesis. i use this use case only to start to use akka toolkit. Than I hope to use a more realistic and extreme use case.
– Alexh2o
Nov 12 at 14:41




I know that this use case doesn't justify the use of akka streams but i worked It as initial parte of my thesis. i use this use case only to start to use akka toolkit. Than I hope to use a more realistic and extreme use case.
– Alexh2o
Nov 12 at 14:41












up vote
0
down vote













I don't think what you are looking for currently exists. However, there is this similar thing called streamRefs which allow you to have reactive streams over the network. Take a look here: https://doc.akka.io/docs/akka/2.5/stream/stream-refs.html






share|improve this answer




















  • I have read about StreamRef but seams to be something to tie two stream over network. Instead i want to tie a single stream to multiple stream on multiple node in a akka cluster. Now i'm using the first stream as publisher and the streams in cluster as consumer with akka Kafka streams but I don't know if It is the best solution
    – Alexh2o
    Nov 12 at 14:45














up vote
0
down vote













I don't think what you are looking for currently exists. However, there is this similar thing called streamRefs which allow you to have reactive streams over the network. Take a look here: https://doc.akka.io/docs/akka/2.5/stream/stream-refs.html






share|improve this answer




















  • I have read about StreamRef but seams to be something to tie two stream over network. Instead i want to tie a single stream to multiple stream on multiple node in a akka cluster. Now i'm using the first stream as publisher and the streams in cluster as consumer with akka Kafka streams but I don't know if It is the best solution
    – Alexh2o
    Nov 12 at 14:45












up vote
0
down vote










up vote
0
down vote









I don't think what you are looking for currently exists. However, there is this similar thing called streamRefs which allow you to have reactive streams over the network. Take a look here: https://doc.akka.io/docs/akka/2.5/stream/stream-refs.html






share|improve this answer












I don't think what you are looking for currently exists. However, there is this similar thing called streamRefs which allow you to have reactive streams over the network. Take a look here: https://doc.akka.io/docs/akka/2.5/stream/stream-refs.html







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 0:11









hveiga

4,67763259




4,67763259











  • I have read about StreamRef but seams to be something to tie two stream over network. Instead i want to tie a single stream to multiple stream on multiple node in a akka cluster. Now i'm using the first stream as publisher and the streams in cluster as consumer with akka Kafka streams but I don't know if It is the best solution
    – Alexh2o
    Nov 12 at 14:45
















  • I have read about StreamRef but seams to be something to tie two stream over network. Instead i want to tie a single stream to multiple stream on multiple node in a akka cluster. Now i'm using the first stream as publisher and the streams in cluster as consumer with akka Kafka streams but I don't know if It is the best solution
    – Alexh2o
    Nov 12 at 14:45















I have read about StreamRef but seams to be something to tie two stream over network. Instead i want to tie a single stream to multiple stream on multiple node in a akka cluster. Now i'm using the first stream as publisher and the streams in cluster as consumer with akka Kafka streams but I don't know if It is the best solution
– Alexh2o
Nov 12 at 14:45




I have read about StreamRef but seams to be something to tie two stream over network. Instead i want to tie a single stream to multiple stream on multiple node in a akka cluster. Now i'm using the first stream as publisher and the streams in cluster as consumer with akka Kafka streams but I don't know if It is the best solution
– Alexh2o
Nov 12 at 14:45










Alexh2o is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Alexh2o is a new contributor. Be nice, and check out our Code of Conduct.












Alexh2o is a new contributor. Be nice, and check out our Code of Conduct.











Alexh2o is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240558%2fakka-streams-akka-cluster%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

27

Top Tejano songwriter Luis Silva dead of heart attack at 64

Category:Rhetoric