Spark is a distributed computing framework, and there must be communication between multiple machines. Spark was implemented in earlier versions using Akka. A rpcenv is now abstracted from the upper Akka. The rpcenv is responsible for managing communication between machines.The RPCENV consists of three main cores:
Rpcendpoint the message loop body, which is responsible for receiving and processing
. The good news is that akka's actor, in terms of concept, contains a lightweight thread of its own, which is completely separated from other parts of the system. This means that you do not need to consider synchronization locks.In the background, akka runs multiple actor objects on a physical thread. Generally, several actors share a physical thread, the subsequent calls of an actor may use different physical threads, but these implementation details
Official Document: Http://developer.lightbend.com/guides/akka-quickstart-java/?_ga= 2.177525157.1012573474.1504767665-546319647.1504766934I. AKKA Hello World Example:1. First you need to create a actorsystem, which is the container for all actors to run.2. Next create the Greeter actor and the printer actor.3. Send the message to the Greeter actor instance, which stores the message internally first.4. The i
dispatcher relies on the execcutor of the thread pool
# is optimized for blocking operations 1.2.3 Balancingdispatcher
He can reassign work from the more busy actor to the more idle actor, the reallocation of tasks is premised on the premise that all actors must be of the same type.
Characteristics:
# only one mailbox
# The dispatcher is shared by all actors of the same type
# The dispatcher relies on a thread pool or fork join pool
1.2.4 Callingthreaddispatcher
He just runs the task on the sa
Scala tutorial, scala Programming
The following is a complete scala getting started tutorial I have collected from the Internet. I have followed other programming basics to get started.
Compared with other languages such as Java, Scala is a complex language. It is a unity of object-oriented and function-oriented. It is
If there is no problem confirming the cluster side, you should check the application.conf of Akka.In Akka cluster, it is mainly through the fault detection mechanism (Failure Detector) to see whether the nodes in the cluster handle the available state. Each node in the cluster is monitored (up to 5) if the remaining nodes in the cluster are in a normal state, when one of the node A detects another node B processing the unreachable (unreachable) state,
What is Akka.
Akka usually refers to a distributed toolset, which is used to coordinate remote computing resources to do some work, and is an implementation of the actor concurrency model.
The origin of the actor.
A theoretical model of concurrent computing is proposed in this paper.
What is actor.
In the actor model, the actor is a concurrency primitive.
Actor and Message delivery
If multithreading r
Akka working with the future Functionally_map method Look at the code, Packagecom.usoft;importakka.dispatch.executioncontexts;importakka.dispatch.futures;import akka.dispatch.mapper;importakka.dispatch.oncomplete;importakka.dispatch.onfailure;import akka.dispatch.OnSuccess;importscala.concurrent.ExecutionContextExecutorService;import scala.concurrent.future;importjava.util.concurrent.callable;importjava.util.concurrent.executors;/ ***createdbyliyanxi
order to prevent a single acotr from occupying threads, Set the maximum number of messages that this ACOTR will be scheduled to execute
Detect-dispatcher {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of Ex Ecutionservice to use
executor = ' fork-join-executor '
# Configuration for the fork join Pool
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = 2
# P Arallelism (Threads)
Scala supports scripts
1) create a file hello. Scala under/opt/Scala-script and edit the file as follows:
$ Hello, this is the first Scala script
2) run the script
The command line parameters of the scala script are saved in the sc
Here's a Akka Java demo to illustrate how Akka works. 1, first download Akka's official bag
The download address is: http://akka.io/downloads/. I downloaded the Akka 2.3.15.
Unzip this compression pack, prepare to copy the associated jar package to your own project 2, create a Java project
Import Packages First
3, the following is the source code and source code
, PostID) }} Bot generated data to the worker actor, pay attention to the Postregion method, it first from the Actorsystem to get Clustersharding collection (a actorsystem may have more than Shard), and then according to SH The ardname is positioned to the unique shard. Finally, the message sent to Postregin,postregin will be forwarded.The StartUp function of the Main methoddef startup (Ports:seq[string]): Unit = {ports foreach {port =//Override The configuration of the port val config
I. Summary
Dispatchers is the heart of the Akka application and this is what makes itHumming. Routers on the other hand, route incoming messages to outbound actors II, Dispatcher type
DispatcherFeatures are as follows:
Every actor is backed by its own mailboxthe dispatcher can is shared with any number of actorsthe dispatcher can be backed by either thread pool or fork join poolthe dispatcher is optimized for non-blocking code
Pinned DispatcherCharac
Actorsystem composed of cluster def main (args:array[string]): Unit = { if (args.isempty) startup (Seq ("2551", "2552", "0")) else Startup (args) } def startup (Ports:seq[string]): Unit = { ports foreach {port = //Override the CONFI Guration of the port val config = configfactory.parsestring ("akka.remote.netty.tcp.port=" + port). Withfallback (Configfactory.load ()) //Create an Akka system val system
Http://www.tuicool.com/articles/m2muui
The original http://2014.54chen.com/blog/2014/04/17/how-to-use-akka-in-java-3/ An example is also a classic example of Typesafe. Examples of services provided are the transmission of text. When the text is sent to the frontend node, it delegates the backend node, backend performs the transformation task, and returns the result to the original client. The new backend nodes and Frontend nodes can be dynamically
What is actor, an object that encapsulates state and behavior, each actor communicates through a message and reads messages from its own mailbox from another actor.
Actorsystem is an entry point into the actor world. Actorsystem is present throughout the creation and cessation of actors. And it also exists when the entire actor environment is turned off.
Props is a configuration class that specifies the creation of an actor.
Props props1 = new Props (class name. Class);
The
1. Translating Java Classes to Scala ClassesExample 1:inch Javapublic class book{}# Scala equivalent of a class Declarationclass bookExample 2:# A Java class with a Construtorpublic class book{ int ISBN; Private final String title; Public book (int ISBN, String title) { = ISBN; = title; } int GETISBN () { return ISBN; } Public String GetTitle () { retu
工欲善其事, its prerequisite. This is also true for Scala, where you have to complete the installation of Scala and choose the right IDE before you start learning ScalaThis paper is mainly divided into two parts:Installation of 1.scala2.11.6 and use of REPLInstallation and use of the 2.Scala eclipse plugin1.scala2.11.6 installation and use of REPLThis section mainly d
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.