# Insert of data using java client is too slow using docker

**URL:** <https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430>\
**Category:** General Discussion\
**Created:** [July 26, 2017, 5:52pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430 "2017-07-26T17:52:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 5:52pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/1 "2017-07-26T17:52:23Z")

</div>

Hi all I tray to insert data using java client server is configured as cluster with 2 nodes the insert of 100 records taked 20min?!!

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 26, 2017, 5:57pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/2 "2017-07-26T17:57:29Z")

</div>

> [@Elias](#):
>
> ```
> AerospikeClient client = new AerospikeClient(“172.28.128.3”, 3000);
> AerospikeClient client = new AerospikeClient(“192.168.99.107”, 3000);
> 
> ```

Why are you creating client object twice? (OK, my misread and thanks for putting the code in readable format now.)

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 5:59pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/3 "2017-07-26T17:59:48Z")

</div>

thanks for reply

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 26, 2017, 6:08pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/4 "2017-07-26T18:08:53Z")

</div>

Nothing obvious pops out. Is the there a network issue between where this code is running (client machine) and the server node? Going over slow wifi? Did you try running the client test code and sever on same machine (localhost)?

Also, try putting your start time and end time around the write loop. Don’t include time to make connection to the cluster although that should be seconds/milliseconds and not minutes!

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:10pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/5 "2017-07-26T18:10:58Z")

</div>

Iam using docker with swarm-manager when i have one node everything is fine?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 26, 2017, 6:12pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/6 "2017-07-26T18:12:23Z")

</div>

OK, I must bow out. Don’t have experience with docker.

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:13pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/7 "2017-07-26T18:13:01Z")

</div>

![23](https://us1.discourse-cdn.com/flex019/uploads/aerospike/original/1X/e23b7303c32df92d9973cc9ac9c3921460904d5d.png)

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:14pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/8 "2017-07-26T18:14:52Z")

</div>

is this due to migration of partitions?

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 26, 2017, 6:15pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/9 "2017-07-26T18:15:33Z")

</div>

Suggest changing title of post to include “docker” describe your setup in the post first. someone with docker experience may help you out.

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:16pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/10 "2017-07-26T18:16:00Z")

</div>

your right thanks lot

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 26, 2017, 6:17pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/11 "2017-07-26T18:17:45Z")

</div>

migration of partitions occurs when nodes are added or removed from cluster and it should not affect client side writes or reads that latency goes to minutes. It may go up by a few milliseconds … but not minutes.

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:22pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/12 "2017-07-26T18:22:50Z")

</div>

thanks ps could you tell me why i get Error Code 14: Hot key

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:24pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/13 "2017-07-26T18:24:01Z")

</div>

and also Client timeout: timeout=70000 iterations=2 lastNode=BB90600FF0A4202 192.168.99.107 3000

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 26, 2017, 6:33pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/14 "2017-07-26T18:33:01Z")

</div>

Hot key means you are either reading or writing the same key repeatedly. The transactions pending limit is 20 by default.

---

<div class="post-metadata">

**Author:** ![rguo](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@rguo](https://discuss.aerospike.com/u/rguo)\
**Post date:** [July 26, 2017, 6:33pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/15 "2017-07-26T18:33:07Z")

</div>

Two issues:

1. Hotkey: You’re writing the SAME record and just replacing bins (fields in RDBs). Since all of your operations are on the same record, you have a “hot” key (index). There are some parameters where you can tune to queue up more hotkey operations, but hotkeys will still occur based on how you’re using it. To resolve the root of the issue, don’t do all of your work in a single record or change to in-memory only storage engine for your really hot records.
2. General performance issue: What are you running on? What’s the hardware behind your docker daemon? What’s the hardware behind your client? What is the relationship between client and server (Different machines over lan? wifi? Internet? Same machine?)

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [July 26, 2017, 6:35pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/16 "2017-07-26T18:35:18Z")

</div>

> [@rguo](#):
>
> You’re writing the SAME record

He is iterating on _i_, so its a different record each write. Hot Key error must be from some other part of the code.

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:37pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/17 "2017-07-26T18:37:23Z")

</div>

yes they are differents records my test for university shall insert 50000 records so iam iterating on i to generate each time new record

---

<div class="post-metadata">

**Author:** ![rguo](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@rguo](https://discuss.aerospike.com/u/rguo)\
**Post date:** [July 26, 2017, 6:41pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/18 "2017-07-26T18:41:21Z")

</div>

> University

Are you running everything on a 2/4 core laptop with a 5400rpm HDD?

---

<div class="post-metadata">

**Author:** ![Elias](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@Elias](https://discuss.aerospike.com/u/Elias)\
**Post date:** [July 26, 2017, 6:57pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/19 "2017-07-26T18:57:04Z")

</div>

client on mac os

---

<div class="post-metadata">

**Author:** ![rguo](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@rguo](https://discuss.aerospike.com/u/rguo)\
**Post date:** [July 26, 2017, 7:46pm UTC](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430/20 "2017-07-26T19:46:26Z")

</div>

If [this](http://www.everymac.com/systems/apple/imac/specs/imac-core-i7-4.0-27-inch-aluminum-retina-5k-late-2014-specs.html) is your particular iMac model, then you have the fusion drive.

The Fusion drive behaves like a hybrid SSHD. That is, you have no explicit control over which files are SSD accelerated and either the drive itself makes the caching decision (in the case of SSHDs) or your OS does (as in the Fusion Drive). In the case of Docker containers, where the raw storage for each container is is hidden from you in a file buried deep in the host filesystem, this creates even more variability in whether the underlying data gets accelerated.

I will treat these types of storage to be no different than HDDs from Aerospike’s operational view.

In short, do not expect performance anywhere near what’s you’d see with an SSD. A typical HDD would be lucky to reach 100 IOPs. However 20mins for 100 record inserts is still concerning. What do the logs say? `docker logs <your aerospike container>`

If you can replicate this, please attach your namespace config and screenshot of Activity Monitor. Or more preferably, use `docker-machine ssh` to log in to a Swarm node and run `top` in boot2docker:

```auto
$ tce-load -wi ncurses
$ TERM=vt100 top -c

```

[Next page](https://discuss.aerospike.com/t/insert-of-data-using-java-client-is-too-slow-using-docker/4430.md?page=2)
