Coder Social home page Coder Social logo

akkawordcounter's Introduction

###Implementation of Concurrency and Fault Tolerance Made Easy: An Akka Tutorial with Examples

Using Akka Actors this reads all text files in a directory and counts the number of words in each file.

This is an Intellij SBT project, so you can clone it and play around. I hope this helps someone! 😀

Example output:

Stream Complete: 2.txt Total Number of Words: 13084 Total Time: 148ms
Stream Complete: 4.txt Total Number of Words: 13084 Total Time: 113ms
Stream Complete: 8.txt Total Number of Words: 9100 Total Time: 107ms
Stream Complete: 5.txt Total Number of Words: 13084 Total Time: 160ms
Stream Complete: 6.txt Total Number of Words: 9100 Total Time: 99ms
Stream Complete: 7.txt Total Number of Words: 9100 Total Time: 109ms
Stream Complete: 3.txt Total Number of Words: 13084 Total Time: 238ms
Stream Complete: 10.txt Total Number of Words: 26168 Total Time: 306ms
Stream Complete: 9.txt Total Number of Words: 1256064 Total Time: 1267ms
Stream Complete: 1.txt Total Number of Words: 1256064 Total Time: 1283ms

Diagram

####Update: Don't create a new ActorSystem for each file.

Thanks Reddit User mmccaskill for pointing it out.

Read more here: [Do I need to re-use the same Akka ActorSystem or can I just create one every time I need one?] (http://stackoverflow.com/questions/10396552/do-i-need-to-re-use-the-same-akka-actorsystem-or-can-i-just-create-one-every-tim)

####Messages are sent to an Actor through one of the following methods.

  • ! means “fire-and-forget”, e.g. send a message asynchronously and return immediately. Also known as tell.
  • ? sends a message asynchronously and returns a Future representing a possible reply. Also known as ask

akkawordcounter's People

Contributors

shehaaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

khvatov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.