logo
down
shadow

akka non-blocking BoundedMailbox


akka non-blocking BoundedMailbox

Content Index :

akka non-blocking BoundedMailbox
Tag : scala , By : Matt
Date : November 26 2020, 01:01 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Blocking IO in Akka


Tag : scala , By : Michael T.
Date : March 29 2020, 07:55 AM
wish of those help Doing blocking IO is a bad idea in general, and in a reactive multithreaded environment in particular, so your first step is to try to avoid it alltogether, that means looking into using AsyncHttpClient or HttpAsyncClient.
If that does not work, you can at least mitigate the risks by giving the blocking actors their own threads. This will of course be costly and you still risk filling up their mailboxes, but such is the choice of using blocking IO.

Deliberate Blocking in Akka Actors


Tag : development , By : user185939
Date : March 29 2020, 07:55 AM
this one helps. I would take approach 1. It should be noted though that actors do not have a dedicated thread by default but they share a thread pool (the so called dispatcher, see: http://doc.akka.io/docs/akka/2.3.6/scala/dispatchers.html). This means that blocking is inherently dangerous because it exhausts the threads of the pool not letting other non-blocked actors to run (since the blocked actors do not put the thread back into the pool). Therefore you should separate blocking calls into a fixed size pool of dedicated actors, and you should assign these actors a PinnedDispatcher. This latter step ensures that these actors do not interfere with each other (they each have a dedicated thread) and ensures that these actors do not interfere with the rest of the system (all of the other actors will run on another dispatchers, usually on default-dispatcher). Be sure though to limit the number of actors running on the PinnedDispatcher since the number of used threads will grow with the number of actors on that dispatcher.

How to use the Akka ask pattern without blocking


Tag : scala , By : user183442
Date : March 29 2020, 07:55 AM
Any of those help You don't want to block, by waiting on the response of the actor, so you are using Future correctly. The code in the onComplete function is executed, when your actor responds with the list.
And since you don't want to block and handle it asynchronously, your last println statement is executed while your actor has not yet responded.
object Test extends App{
  val system = ActorSystem("testing")
  val MyActor = system.actorOf(Props[MyActor], name = "InstitutionUserSuggestion")
  implicit val timeout = Timeout(15 seconds)

  val future: Future[List[Int]] = ask(MyActor,"returnAlist").mapTo[List[Int]] 
  future.onComplete { 
    case Success(result)=>
      println("returned list size is " + result.size +" and its contents" + result)
    case Failure(e)=>
      println("in failure")
      e.printStackTrace()
  }
}

Akka and blocking operations


Tag : development , By : Topher Cyll
Date : March 29 2020, 07:55 AM
hope this fix your issue The Akka project is very supportive of the Reactive Manifesto. The documentation assumes that by using Akka you are also interested in building a system according to the Reactive Manifesto.
A key part of the Reactive Manifesto is that systems should remain responsive at all times. If you used the same dispatcher/thread pool for the blocking DB operations as for your main Akka routing infrastructure, it is possible that all the Akka threads could be occupied by the DB operations, and your system would effectively be deadlocked until one of the DB operations completes. This might not be a problem for a simple system on a single JVM that only performs this task, but it's easy to think of new features that would make this a problem:

Blocking calls in Akka Actors


Tag : multithreading , By : Marianisho
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Scala Tuple2Zipped vs IterableLike zip
  • How can i check for empty values on spark Dataframe using User defined functions
  • Import Scala object based on value of commandline argument
  • How to get the type parameters from an abstract class that is extended by an object
  • Databricks: Dataframe groupby agg, collector set include duplicate values
  • When to do .repartition(Int AnyValue) in Spark, right after reading the Parquet (or) after running computations on that
  • How can I get an empty collection of the same type as a given instance?
  • How to validate Date Column of dateframe
  • Tail recursion and call by name / value
  • Why there is a different error message on using += and a=x+y on a val variable?
  • Histogram for RDD in Scala?
  • What is value of '_.nextInt' in this expression in Scala
  • Modify keys in Spray JSON
  • base64 decoding of a dataframe
  • Identifying object fields with strings in Scala
  • ScalaTest can't verify mock function invocations inside Future
  • Is it safe to catch an Exception object
  • what is the optimal way to show differences between two data sets
  • case class inheriting another class/trait
  • Scala naming convention for Futures
  • Fs2 Stream.Compiler is not found (could not find implicit value Compiler[[x]F[x],G])
  • Can you mock a value rather than a method?
  • PureConfig ConfigLoader in Scala
  • How to extract latest/recent partition from the list of year month day partition columns
  • How can I partition a RDD respecting order?
  • How beneficial is Parallel Seq for executing sequence of statements?
  • How to obtain class type from case class value
  • How do I append an element to a list in Scala
  • scala - mock function and replace implementation in tests
  • Scala: no-name parameters in function with List and Option
  • How to add the schema in a dataframe from a config file
  • Decreasing the compilation time when using shapeless HList
  • Sorting List of values in a RDD in Scala
  • How to manage the hierarchy of State in Functional Programming?
  • can we declare variables and use them in for loop in scala
  • Bind columns of 2 different dataframes spark
  • Sum of an array elements through while loop
  • Scala: Using Trait + Companion object to enumerate implementations
  • Which tools can I use to benchmark a scala code?
  • Converting Case Classes with params as Case Classes to Avro Message to send to Kafka
  • Stop the fs2-stream after a timeout
  • Is there a way New->Scala Class in intellij can default to creating a case class (vs a regular class)?
  • scala filter list of object if some fields in the object are same
  • How to Sorting results after run code in Spark
  • reduce RDD having key as (String,String)
  • Accessibility of scala constructor parameters
  • list Pattern Matching to return a new list of every other element
  • How can I modify this Ordering?
  • Lagom: is number of read side shards set per node or within the whole cluster?
  • How to create multiple dataframe using same case class
  • Scala mockito: Delay Mockito.when().thenReturn(someFuture)
  • throw exception does not work inside future.map scala?
  • compare case class fields with sub fields of another case class in scala
  • How can I get random data generated for scala case classes with the ability to "change some values" for unit t
  • How to change "hostname" while running sbt run?
  • Wrapping string interpolator macro in another
  • Understanding the diagrams of Product and Coproduct
  • How would you pop an element from the end of a list in scala, and add it to the end of another list?
  • Load RDD from name
  • Assign same value to multiple variables in Scala
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com