【发布时间】:2018-12-01 13:57:44
【问题描述】:
当我在使用 akka 同步参与者的 API 上运行负载测试时(使用超时 20 秒的询问模式,代码如下 sn-p),API 调用一个微服务,该微服务与 Oracle DB 交互以进行获取操作。
但是在负载测试期间(每秒 100 个请求)我看到很多超时异常,并且在外部微服务和 Oracle 中都没有看到任何错误。 使用 fork join 执行器时,故障很少,但使用线程池执行器时,我看到经常发生故障。
代码sn-p:
Timeout timeout = new Timeout(Duration.create(interaction.getActorTimeOut(), TimeUnit.SECONDS));
Future<Object> future = Patterns.ask(ipsActorSystem.synchronousActor, interactionRequest, timeout);
Object result = Await.result(future, timeout.duration());
akka config(Fork 加入执行器):
"default-dispatcher": {
"attempt-teamwork": "on",
"default-executor": {
"fallback": "fork-join-executor"
},
"executor": "fork-join-executor",
"fork-join-executor": {
"parallelism-factor": 50,
"parallelism-max": 100,
"parallelism-min": 10,
"task-peeking-mode": "FIFO"
},
"mailbox-requirement": "",
"shutdown-timeout": "1s",
"throughput": 100,
"throughput-deadline-time": "0ms",
"type": "Dispatcher"
},
线程池执行器:
"default-dispatcher": {
"attempt-teamwork": "on",
"default-executor": {
"fallback": "thread-pool-executor"
},
"executor": "thread-pool-executor",
"thread-pool-executor": {
"fixed-pool-size" : 10
},
"mailbox-requirement": "",
"shutdown-timeout": "1s",
"throughput": 10,
"throughput-deadline-time": "0ms",
"type": "Dispatcher"
},
【问题讨论】:
-
这可能会对您有所帮助。在下面的链接上查看我的帖子.. stackoverflow.com/questions/50940162/akka-actor-messaging-delay/…
-
非常感谢您的回复..
标签: java oracle akka microservices