ray/java
Qing Wang c5252c5ceb
[Java] Support parallel actor in experimental. (#21701)
For the purpose to provide an alternative option for running multiple actor instances in a Java worker process, and the eventual goal is to remove the original multi-worker-instances in one worker process implementation.  we're proposing supporting parallel actor concept in Java. This feature enables that users could define some homogeneous parallel execution instances in an actor, and all instances hold one thread as the execution backend.

### Introduction

For the following example, we define a parallel actor with  10 parallelism. The backend actor has 10 concurrency groups for the parallel executions, it also means there're 10 threads for that.

We can access the instance by the instance handle, like:
```java
ParallelActorHandle<A> actor = ParallelActor.actor(A::new).setParallelism(10).remote();
ParallelInstance<A> instance = actor.getInstance(/*index=*/ 2);
Preconditions.checkNotNull(instance);
Ray.get(instance.task(A::incr, 1000000).remote()); // print 1000000           

instance = actor.getInstance(/*index=*/ 2);
Preconditions.checkNotNull(instance);
Ray.get(instance.task(A::incr, 2000000).remote().get()); // print 3000000

instance = actor.getInstance(/*index=*/ 3);
Preconditions.checkNotNull(instance);
Ray.get(instance.task(A::incr, 2000000).remote().get()); // print 2000000
```


### Limitation
- It doesn't support concurrency group on a parallel actor yet.

Co-authored-by: Kai Yang <kfstorm@outlook.com>
2022-04-21 22:54:33 +08:00
..
api [Java] Support parallel actor in experimental. (#21701) 2022-04-21 22:54:33 +08:00
performance_test [Java] Remove auto-generated pom.xml files. (#19475) 2021-10-19 17:35:37 +08:00
runtime [Java] Support parallel actor in experimental. (#21701) 2022-04-21 22:54:33 +08:00
serve [Serve] Add test for controller managing Java Replica (#22628) 2022-02-28 23:13:56 -08:00
test [Java] Support parallel actor in experimental. (#21701) 2022-04-21 22:54:33 +08:00
build-jar-multiplatform.sh Remove streaming deploying process. (#21603) 2022-01-17 23:37:48 +08:00
BUILD.bazel [Java] Add javac.activative dependency for java worker. (#22538) 2022-02-23 16:24:47 +08:00
checkstyle-suppressions.xml [Java] Format ray java code (#13056) 2020-12-29 10:36:16 +08:00
checkstyle.xml [Java] Support parallel actor in experimental. (#21701) 2022-04-21 22:54:33 +08:00
cleanup.sh Shellcheck comments (#9595) 2020-07-21 16:47:09 -05:00
dependencies.bzl [Java] upgrade protobuf-java version (#23627) 2022-03-31 09:12:58 -07:00
generate_jni_header_files.sh Use javac -h instead of javah. (#19311) 2021-10-12 22:37:14 +08:00
java-release-guide.md [Java] Add Java release guideline. (#22288) 2022-02-11 14:56:20 +08:00
pom.xml [Java] Support parallel actor in experimental. (#21701) 2022-04-21 22:54:33 +08:00
shade_rule [Java] Shade some widely used dependencies in bazel_jar_jar rule. (#21237) 2021-12-23 16:54:31 +08:00
test.sh [Java] Shade some widely used dependencies in bazel_jar_jar rule. (#21237) 2021-12-23 16:54:31 +08:00
testng.xml [Serve] Define Java Backend (#16169) 2021-07-01 20:41:17 -07:00