Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Add less than 2 seconds random waiting time in writerThread #40

Merged
merged 1 commit into from
Jul 2, 2013
Merged

Conversation

sunweik
Copy link
Contributor

@sunweik sunweik commented Jul 1, 2013

No description provided.

@@ -290,7 +292,8 @@ class AppRuntime(appID: Int,
flushDirtySlateToCassandra()
debug("writeThread: flush dirty slates is done")
val exeuteTime = java.lang.System.currentTimeMillis - startTime
val sleepTime = appStatic.cassWriteInterval * 1000 - exeuteTime
// add around 2 seconds random sleep time
val sleepTime = appStatic.cassWriteInterval * 1000 - exeuteTime + (if (rand.nextBoolean) -(rand.nextInt & 0x7ff) else rand.nextInt & 0x7ff)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the seed to rand, randomly initialized? Also, I would prefer if the batch write were broken up into smaller chunks instead of the random skew in write time intervals.

@sunweik
Copy link
Contributor Author

sunweik commented Jul 2, 2013

The seed is inited once by system time in constructor.

For now I don't see necessity to break one chunk write into smaller jobs since pelops.execute time is actually way much shorter than pelops.write time in our test. If in future we see any type of failure caused by size of writing chunk I definitely will think of using smaller size of writing job.

sunweik added a commit that referenced this pull request Jul 2, 2013
Add less than 2 seconds random waiting time in writerThread
@sunweik sunweik merged commit eaba219 into master Jul 2, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants