# How to run operations in parallel

**URL:** <https://discuss.elastic.co/t/how-to-run-operations-in-parallel/142261>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [July 31, 2018, 12:28am UTC](https://discuss.elastic.co/t/how-to-run-operations-in-parallel/142261 "2018-07-31T00:28:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![username123](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@username123](https://discuss.elastic.co/u/username123)\
**Post date:** [July 31, 2018, 12:28am UTC](https://discuss.elastic.co/t/how-to-run-operations-in-parallel/142261/1 "2018-07-31T00:28:32Z")

</div>

So I have a simple challenges file:

```
  5 {
  6 "schedule": "poisson"
  7 },
  8 {
  9 "operation": "index-append",
 10 "schedule": "poisson"
 11 },
 12 {
 13 "operation": "phrase",
 14 "iterations": 1000,
 15 "schedule": "poisson"
 16 }
 17 ]
 18 }

```

I run this command:

`esrally --pipeline=benchmark-only --target-hosts host-to-test:80`

I see the tool output:

```
Running index-append [100% done]
Running phrase [100% done]

```

I see the log of the requests on the host:

```
...many before...
[2018-07-31T00:17:04+00:00] 10.20.0.3 - "c1c-searchclienta101-prod" "POST /_bulk HTTP/1.1" 200 1285036 "-" "-" "-" 1.200 - "-"
[2018-07-31T00:17:06+00:00] 10.20.0.3 - "c1c-searchclienta101-prod" "POST /_bulk HTTP/1.1" 200 1285036 "-" "-" "-" 1.167 - "-"
[2018-07-31T00:17:06+00:00] 10.20.0.3 - "c1c-searchclienta101-prod" "POST /_bulk HTTP/1.1" 200 231335 "-" "-" "-" 0.075 - "-"
[2018-07-31T00:17:11+00:00] 10.20.0.3 - "c1c-searchclienta101-prod" "GET /geonames/_search?request_cache=false HTTP/1.1" 200 4358 "-" "-" "-" 0.006 - "-"
[2018-07-31T00:17:11+00:00] 10.20.0.3 - "c1c-searchclienta101-prod" "GET /geonames/_search?request_cache=false HTTP/1.1" 200 4358 "-" "-" "-" 0.005 - "-"
[2018-07-31T00:17:11+00:00] 10.20.0.3 - "c1c-searchclienta101-prod" "GET /geonames/_search?request_cache=false HTTP/1.1" 200 4358 "-" "-" "-" 0.004 - "-"
...many after...

```

But I want my operations to emulate the traffic in production though. Meaning that some of them would be bulk at a certain rate and have some search in between, bulks again, search again etc... defining all those individually would be quite a pain. Is there a way to schedule several operations in parallel? So my requests for all of them come in at random?

I was trying to search for something like this in the docs, but seems like the only thing I see that could be in the right direction is custom scheduler? I don't know if I should write this.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 31, 2018, 7:41am UTC](https://discuss.elastic.co/t/how-to-run-operations-in-parallel/142261/2 "2018-07-31T07:41:57Z")

</div>

I have done something similar in my [rally-eventdata-track](https://github.com/elastic/rally-eventdata-track/blob/master/eventdata/challenges/combined-indexing-and-querying.json#L67) where I combine a rate limited indexing with a number of concurrent query threads.

---

<div class="post-metadata">

**Author:** ![dliappis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dliappis/32/56174_2.png) [@dliappis](https://discuss.elastic.co/u/dliappis)\
**Post date:** [July 31, 2018, 8:43am UTC](https://discuss.elastic.co/t/how-to-run-operations-in-parallel/142261/3 "2018-07-31T08:43:10Z")

</div>

As @Christian_Dahlqvist mentioned, you can take a look at the [parallel element](https://esrally.readthedocs.io/en/stable/track.html?highlight=parallel#running-tasks-in-parallel).

---

<div class="post-metadata">

**Author:** ![username123](https://avatars.discourse-cdn.com/v4/letter/u/7ba0ec/32.png) [@username123](https://discuss.elastic.co/u/username123)\
**Post date:** [July 31, 2018, 4:41pm UTC](https://discuss.elastic.co/t/how-to-run-operations-in-parallel/142261/4 "2018-07-31T16:41:23Z")

</div>

Yep, this totally works.

Funny enough was trying to search "parallel operations" in the docs and it didn't give me anything. Searching just for "parallel" does lead to the page you've linked. Consider using elasticsearch for search in your docs ; )

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 28, 2018, 4:53pm UTC](https://discuss.elastic.co/t/how-to-run-operations-in-parallel/142261/5 "2018-08-28T16:53:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
