[jira] [Commented] (LUCENE-10393) Should we unify the dictionary builder/loader of kuromoji and nori?

2022-03-10 Thread Tomoko Uchida (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504211#comment-17504211
 ] 

Tomoko Uchida commented on LUCENE-10393:


Both Kuromoji and Nori have `BinaryDictionary` and `BinaryDictionaryWriter` 
classes, and there is significant code duplication. This PR unifies them by 
decoupling language-specific information (or morphological information) from 
the base dictionary interface.

[https://github.com/apache/lucene/pull/740]

This is fairly large (in order to make it self-contained) but in a nutshell, 
there are two conceptual interfaces:
 - Dictionary: a high-level interface parameterized by a specific 
MorphAttributes
 - MorphAttributes: a high-level interface that represents morphological 
information. This is supposed to be extended to hold language-specific details.

and base classes that have common logic in kuromoji and nori:
 - BinaryDictionary: abstract base class for the dictionary lookup operation
 - BinaryDictionaryWriter: abstract base class for writing dictionary files

Those classes reside in the analyzers-common module; I added 
`org.apache.lucene.analysis.morph` package to it.

Then, each concrete dictionary class can be rewritten by extending the above 
interfaces. For example,
 - Kuromoji's `TokenInforDictionary` is a `BinaryDictionary` that is bounded to 
`TokenInfoMorphAttributes` (an instance of `JaMorphAttributes`).
 - Nori's `UnknownDictionary` is a `BinaryDictionary` that is bounded to 
`UnknownMorphAttributes` (an instance of `KoMorphAttributes`)

The main points of the PR are reducing code duplication and sorting out the 
interfaces. While Kuromoji and Nori have been independently evolved so far, 
they are still conceptually the same, and I think re-unifying them at some 
level may be good for future development and bug fixes.

> Should we unify the dictionary builder/loader of kuromoji and nori?
> ---
>
> Key: LUCENE-10393
> URL: https://issues.apache.org/jira/browse/LUCENE-10393
> Project: Lucene - Core
>  Issue Type: Improvement
>  Components: modules/analysis
>Reporter: Tomoko Uchida
>Priority: Major
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> A spin-off from LUCENE-8816.
> Kuromoji and Nori have many duplicated code in their dictionary 
> builder/loader and we occasionally have to maintain both of them; I'd like to 
> explore the possibility of their unification at some level.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] rmuir commented on pull request #740: LUCENE-10393: Unify binary dictionary and dictionary writer in kuromoji and nori

2022-03-10 Thread GitBox


rmuir commented on pull request #740:
URL: https://github.com/apache/lucene/pull/740#issuecomment-1064044898


   I only looked at the high-level design so far, this seems to be a good 
approach @mocobeta ! Thank you for tackling it. I think the bottom-up approach 
is a good one, and splitting out the morphological data into separate interface 
makes sense to me. 
   
   I would suggest reconsidering the name `MorphAttributes`, mostly because 
"Attributes" already has a complex meaning within lucene analysis. Some 
possibilities (not exhaustive list):
   * `MorphData`
   * `DictionaryData`
   
   I will do more review and testing, I am digging into it in detail.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] kkewwei opened a new pull request #741: LUCENE-9998: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


kkewwei opened a new pull request #741:
URL: https://github.com/apache/lucene/pull/741


   # Description
   
   In the merge write process, if there is a long interval between two chunk 
writes, then the second chunk write will be not paused, as the result, the 
instant writing rate of the second chunk is high, which is far more than the 
limited rate.
   
   # Tests
   
   Added TestRateLimitedIndexOutput. 
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] I have reviewed the guidelines for [How to 
Contribute](https://wiki.apache.org/lucene/HowToContribute) and my code 
conforms to the standards described there to the best of my ability.
   - [ ] I have created a Jira issue and added the issue ID to my pull request 
title.
   - [ ] I have given Lucene maintainers 
[access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended)
   - [ ] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] rmuir commented on pull request #740: LUCENE-10393: Unify binary dictionary and dictionary writer in kuromoji and nori

2022-03-10 Thread GitBox


rmuir commented on pull request #740:
URL: https://github.com/apache/lucene/pull/740#issuecomment-1064048298


   I ran `./gradlew regenerate --rerun-tasks` on your branch as an additional 
test and all binary data files were unchanged. So I feel good about correctness!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Commented] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504268#comment-17504268
 ] 

kkewwei commented on LUCENE-10448:
--

With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

I have see you code, it seems doesn't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we begin to count the 
starting time, not the last end time.


> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504268#comment-17504268
 ] 

kkewwei edited comment on LUCENE-10448 at 3/10/22, 1:39 PM:


With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

[~vigyas] I have see you code, it seems doesn't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we begin to count the 
starting time, not the last end time.



was (Author: kkewwei):
With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

I have see you code, it seems doesn't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we begin to count the 
starting time, not the last end time.


> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] msokolov commented on a change in pull request #738: LUCENE-10448: Avoid instant rate write bursts by writing bytes buffer in chunks

2022-03-10 Thread GitBox


msokolov commented on a change in pull request #738:
URL: https://github.com/apache/lucene/pull/738#discussion_r823760258



##
File path: 
lucene/core/src/java/org/apache/lucene/store/RateLimitedIndexOutput.java
##
@@ -68,9 +68,14 @@ public void writeByte(byte b) throws IOException {
 
   @Override
   public void writeBytes(byte[] b, int offset, int length) throws IOException {
-bytesSinceLastPause += length;
-checkRate();
-delegate.writeBytes(b, offset, length);
+while (length > 0) {
+  int chunk = (int) Math.min(currentMinPauseCheckBytes + 1, length);

Review comment:
   we could get in an infinite loop or throw an error or something if 
`currentMinPauseCheckBytes` is negative. We should prevent that where it is set 
and add an assertion here. I guess this is pre-existing, but this does add a 
new failure mode. Maybe just add an assert?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504268#comment-17504268
 ] 

kkewwei edited comment on LUCENE-10448 at 3/10/22, 2:24 PM:


With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

[~vigyas] I have seen you code, it seems don't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we begin to count the 
starting time, not the last end time.



was (Author: kkewwei):
With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

[~vigyas] I have see you code, it seems doesn't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we begin to count the 
starting time, not the last end time.


> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504268#comment-17504268
 ] 

kkewwei edited comment on LUCENE-10448 at 3/10/22, 2:25 PM:


With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

[~vigyas] I have seen you code, it seems don't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we count the starting 
time, not the last end time.



was (Author: kkewwei):
With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

[~vigyas] I have seen you code, it seems don't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we begin to count the 
starting time, not the last end time.


> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504268#comment-17504268
 ] 

kkewwei edited comment on LUCENE-10448 at 3/10/22, 2:28 PM:


With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

[~vigyas] I have seen you code, it seems don't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, the start time of chunk writing lasted time is the 
time we start write bytes, not the last chunk writing end time.



was (Author: kkewwei):
With many the statistics, all the detailBytes(mb) are always ~0.73mb, it is a 
high probability that there are no large chunk bytes.  the reason why instant 
rate of up to 460 mb/s is that there is no wait. if we write 1mb to disk, the 
writing rate can be 500mb/s+.

[~vigyas] I have seen you code, it seems don't solve the case: 
If there is a long interval between two chunks writing, then the second chunk 
write will be not paused, as the result, the instant writing rate of the second 
chunk is high, which is far more than the limited rate. 

I raised [PR-#741|https://github.com/apache/lucene/pull/741], to avoid the long 
interval between two chunks, when we start write bytes, we count the starting 
time, not the last end time.


> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] jtibshirani commented on a change in pull request #739: Adapt release smoke tester for 9.1

2022-03-10 Thread GitBox


jtibshirani commented on a change in pull request #739:
URL: https://github.com/apache/lucene/pull/739#discussion_r824045245



##
File path: dev-tools/scripts/smokeTestRelease.py
##
@@ -658,7 +659,7 @@ def testDemo(run_java, isSrc, version, jdk):
 searchFilesCmd = 'java -cp "%s" org.apache.lucene.demo.SearchFiles -index 
index -query lucene' % cp
   else:
 # For binary release, set up classpath as modules.
-cp = "--module-path modules"
+cp = "--module-path modules:modules-thirdparty"

Review comment:
   This is obviously not what we'd do, just a hack so I could move onto the 
next issue.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Commented] (LUCENE-10459) Update smoke tester for 9.1

2022-03-10 Thread Julie Tibshirani (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504547#comment-17504547
 ] 

Julie Tibshirani commented on LUCENE-10459:
---

I did some digging into previous commits.
* Before commit "LUCENE-10255: initial support for Java Modules (squashed)", 
the smoke tester basically works, there are no complaints about dependencies or 
folders.
* After LUCENE-10255, we start to get errors during the demo like 
"java.lang.module.FindException: Module com.carrotsearch.hppc not found, 
required by org.apache.lucene.facet"
* Then with commit "LUCENE-10301: Place test-framework into separated modules 
folder" we start to get errors around an unexpected folder 
"modules-test-framework".

I'm not really knowledgeable enough about the changes to attempt some fixes. 
[~dweiss] or [~tomoko] would you be able to dig into these failures? I 
encountered them by following the release wizard steps. Outside the release 
wizard, I think you could do this to reproduce:
* Check out branch_9_1
* Run "python3 -u dev-tools/scripts/buildAndPushRelease.py  --push-local 
  --rc-num 1  --dev-mode"
* Run "python3 -u dev-tools/scripts/smokeTestRelease.py --not-signed --tmp-dir 
 /lucene-9.1.0-RC1-rev-"

Let me know if I can help with anything.

> Update smoke tester for 9.1
> ---
>
> Key: LUCENE-10459
> URL: https://issues.apache.org/jira/browse/LUCENE-10459
> Project: Lucene - Core
>  Issue Type: Bug
>Reporter: Julie Tibshirani
>Priority: Major
>
> While working on the 9.1 release, I ran into several failures in the smoke 
> tester that seem related to our move to the module system. At a high level, 
> they include:
> * Including test directories in the binary distribution
> * Missing dependencies for the demo
> I opened this PR to show the details of the issues: 
> https://github.com/apache/lucene/pull/739.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Updated] (LUCENE-10459) Update smoke tester for 9.1

2022-03-10 Thread Julie Tibshirani (Jira)


 [ 
https://issues.apache.org/jira/browse/LUCENE-10459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julie Tibshirani updated LUCENE-10459:
--
Affects Version/s: 9.1

> Update smoke tester for 9.1
> ---
>
> Key: LUCENE-10459
> URL: https://issues.apache.org/jira/browse/LUCENE-10459
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 9.1
>Reporter: Julie Tibshirani
>Priority: Major
>
> While working on the 9.1 release, I ran into several failures in the smoke 
> tester that seem related to our move to the module system. At a high level, 
> they include:
> * Including test directories in the binary distribution
> * Missing dependencies for the demo
> I opened this PR to show the details of the issues: 
> https://github.com/apache/lucene/pull/739.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10459) Update smoke tester for 9.1

2022-03-10 Thread Julie Tibshirani (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504547#comment-17504547
 ] 

Julie Tibshirani edited comment on LUCENE-10459 at 3/10/22, 8:03 PM:
-

I did some digging into previous commits.
* Before commit "LUCENE-10255: initial support for Java Modules (squashed)", 
the smoke tester basically works, there are no complaints about dependencies or 
folders.
* After LUCENE-10255, we start to get errors during the demo like 
"java.lang.module.FindException: Module com.carrotsearch.hppc not found, 
required by org.apache.lucene.facet"
* Then with commit "LUCENE-10301: Place test-framework into separated modules 
folder" we start to get errors around an unexpected folder 
"modules-test-framework".

I'm not really knowledgeable enough about the changes to attempt some fixes. 
[~dweiss] or [~tomoko] would you be able to dig into these failures? I 
encountered them by following the release wizard steps. Outside the release 
wizard, I think you could do this to reproduce:
* Check out branch_9_1
* Run {code}python3 -u dev-tools/scripts/buildAndPushRelease.py  --push-local 
  --rc-num 1  --dev-mode{code}
* Run {code}python3 -u dev-tools/scripts/smokeTestRelease.py --not-signed 
--tmp-dir  /lucene-9.1.0-RC1-rev-{code}

Let me know if I can help with anything.


was (Author: julietibs):
I did some digging into previous commits.
* Before commit "LUCENE-10255: initial support for Java Modules (squashed)", 
the smoke tester basically works, there are no complaints about dependencies or 
folders.
* After LUCENE-10255, we start to get errors during the demo like 
"java.lang.module.FindException: Module com.carrotsearch.hppc not found, 
required by org.apache.lucene.facet"
* Then with commit "LUCENE-10301: Place test-framework into separated modules 
folder" we start to get errors around an unexpected folder 
"modules-test-framework".

I'm not really knowledgeable enough about the changes to attempt some fixes. 
[~dweiss] or [~tomoko] would you be able to dig into these failures? I 
encountered them by following the release wizard steps. Outside the release 
wizard, I think you could do this to reproduce:
* Check out branch_9_1
* Run "python3 -u dev-tools/scripts/buildAndPushRelease.py  --push-local 
  --rc-num 1  --dev-mode"
* Run "python3 -u dev-tools/scripts/smokeTestRelease.py --not-signed --tmp-dir 
 /lucene-9.1.0-RC1-rev-"

Let me know if I can help with anything.

> Update smoke tester for 9.1
> ---
>
> Key: LUCENE-10459
> URL: https://issues.apache.org/jira/browse/LUCENE-10459
> Project: Lucene - Core
>  Issue Type: Bug
>Reporter: Julie Tibshirani
>Priority: Major
>
> While working on the 9.1 release, I ran into several failures in the smoke 
> tester that seem related to our move to the module system. At a high level, 
> they include:
> * Including test directories in the binary distribution
> * Missing dependencies for the demo
> I opened this PR to show the details of the issues: 
> https://github.com/apache/lucene/pull/739.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Commented] (LUCENE-10459) Update smoke tester for 9.1

2022-03-10 Thread Dawid Weiss (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504557#comment-17504557
 ] 

Dawid Weiss commented on LUCENE-10459:
--

Hi Julie. I'll try to help out tomorrow. This reminds me about [~rmuir]'s 
suggestion that we should run the smoke tester on the CI occasionally - just so 
that we can catch such issues earlier than at release time. It shouldn't be too 
hard with github actions (periodic one that runs a sequence of smoke tester 
commands, basically).

> Update smoke tester for 9.1
> ---
>
> Key: LUCENE-10459
> URL: https://issues.apache.org/jira/browse/LUCENE-10459
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 9.1
>Reporter: Julie Tibshirani
>Priority: Major
>
> While working on the 9.1 release, I ran into several failures in the smoke 
> tester that seem related to our move to the module system. At a high level, 
> they include:
> * Including test directories in the binary distribution
> * Missing dependencies for the demo
> I opened this PR to show the details of the issues: 
> https://github.com/apache/lucene/pull/739.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Commented] (LUCENE-10459) Update smoke tester for 9.1

2022-03-10 Thread Uwe Schindler (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504565#comment-17504565
 ] 

Uwe Schindler commented on LUCENE-10459:


There is a job on Jenkins, but it was disabled with Gradle, because there was 
an ant target that was executed by Jenkins. If you tell me the exact command 
line sequence (a shell script) to build a release and test it, I can reenable 
it. That's no issue at all.

> Update smoke tester for 9.1
> ---
>
> Key: LUCENE-10459
> URL: https://issues.apache.org/jira/browse/LUCENE-10459
> Project: Lucene - Core
>  Issue Type: Bug
>Affects Versions: 9.1
>Reporter: Julie Tibshirani
>Priority: Major
>
> While working on the 9.1 release, I ran into several failures in the smoke 
> tester that seem related to our move to the module system. At a high level, 
> they include:
> * Including test directories in the binary distribution
> * Missing dependencies for the demo
> I opened this PR to show the details of the issues: 
> https://github.com/apache/lucene/pull/739.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] vigyasharma commented on a change in pull request #741: LUCENE-9998: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


vigyasharma commented on a change in pull request #741:
URL: https://github.com/apache/lucene/pull/741#discussion_r824040011



##
File path: lucene/core/src/java/org/apache/lucene/index/MergeRateLimiter.java
##
@@ -124,16 +125,21 @@ private long maybePause(long bytes, long curNS) throws 
MergePolicy.MergeAbortedE
 // Time we should sleep until; this is purely instantaneous
 // rate (just adds seconds onto the last time we had paused to);
 // maybe we should also offer decayed recent history one?
-long targetNS = lastNS + (long) (10 * secondsToPause);
-
+long targetNS = lastedTime + (long) (10 * secondsToPause);
 long curPauseNS = targetNS - curNS;

Review comment:
   `lastedTime` is essentially the time time spent between two `pause()` 
calls, whereas `curNS` is current time. So `curPauseNS` will usually be 
negative now, right?

##
File path: 
lucene/core/src/java/org/apache/lucene/store/RateLimitedIndexOutput.java
##
@@ -61,42 +64,57 @@ public long getChecksum() throws IOException {
 
   @Override
   public void writeByte(byte b) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause++;
-checkRate();
 delegate.writeByte(b);
+checkRate();
   }
 
   @Override
   public void writeBytes(byte[] b, int offset, int length) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += length;
-checkRate();
 delegate.writeBytes(b, offset, length);
+checkRate();
   }
 
   @Override
   public void writeInt(int i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Integer.BYTES;
-checkRate();
 delegate.writeInt(i);
+checkRate();
   }
 
   @Override
   public void writeShort(short i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Short.BYTES;
-checkRate();
 delegate.writeShort(i);
+checkRate();
   }
 
   @Override
   public void writeLong(long i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Long.BYTES;
-checkRate();
 delegate.writeLong(i);
+checkRate();
   }
 
   private void checkRate() throws IOException {
 if (bytesSinceLastPause > currentMinPauseCheckBytes) {
-  rateLimiter.pause(bytesSinceLastPause);
+  rateLimiter.pause(bytesSinceLastPause, System.nanoTime() - 
writeStartingTime);

Review comment:
   At a high level, I feel this makes it a little harder to consume a 
`RateLimiter`, as callers now also have to track some time window. Maybe it is 
central to solving the instant rate problem, I'm not sure I get it yet. But if 
not, it would be good to avoid that complexity..
   
   On similar lines, I'm now wondering if `checkRate()` should really be a 
`RateLimiter` API instead of being implemented by consumers.

##
File path: lucene/core/src/java/org/apache/lucene/index/MergeRateLimiter.java
##
@@ -124,16 +125,21 @@ private long maybePause(long bytes, long curNS) throws 
MergePolicy.MergeAbortedE
 // Time we should sleep until; this is purely instantaneous
 // rate (just adds seconds onto the last time we had paused to);
 // maybe we should also offer decayed recent history one?
-long targetNS = lastNS + (long) (10 * secondsToPause);
-
+long targetNS = lastedTime + (long) (10 * secondsToPause);
 long curPauseNS = targetNS - curNS;
 
 // We don't bother with thread pausing if the pause is smaller than 2 msec.
 if (curPauseNS <= MIN_PAUSE_NS) {
-  // Set to curNS, not targetNS, to enforce the instant rate, not
-  // the "averaged over all history" rate:
-  lastNS = curNS;
-  return -1;
+  if (itera == 0) {
+curPauseNS = (long) (10 * secondsToPause) - lastedTime;

Review comment:
   Since `itera` is always 0 when `maybePause` is called, is the idea to 
always pause, regardless of when the last pause was called? What is the 
relevance of `lastedTime` ?
   
   I'm sorry I don't quite understand how this alleviates the instant rate 
problem. Could you help explain this more?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread Vigya Sharma (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504574#comment-17504574
 ] 

Vigya Sharma edited comment on LUCENE-10448 at 3/10/22, 8:45 PM:
-

{quote}With many the statistics, all the detailBytes(mb) are always ~0.73mb, it 
is a high probability that there are no large chunk bytes. the reason why 
instant rate of up to 460 mb/s is that there is no wait. if we write 1mb to 
disk, the writing rate can be 500mb/s+
{quote}
Without large chunk bytes, I don't understand why this would happen. Can you 
share more details on how you are calculating {{detailRate}} ? If you are 
looking at {{{}(bytes-written-between-two-pauses / 
time-between-two-pauses){}}}, then that can easily be higher than the 
configured rate, as the rate is only imposed during the pauses. Between them, 
the writes are only really limited by the limits of your IO.


was (Author: vigyas):
{quote}With many the statistics, all the detailBytes(mb) are always ~0.73mb, it 
is a high probability that there are no large chunk bytes. the reason why 
instant rate of up to 460 mb/s is that there is no wait. if we write 1mb to 
disk, the writing rate can be 500mb/s+
{quote}
Without large chunk bytes, I don't understand why this would happen. Can you 
share more details on how you are calculating {{detailRate}} ? If you are 
looking at {{{}(bytes-written-between-two-pauses / 
time-between-two-pauses){}}}, then that can easily be higher than the 
configured rate, as the rate is only imposed during the pauses. Between them, 
the writes are only really limited by the limits of your IO.

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Commented] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread Vigya Sharma (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504574#comment-17504574
 ] 

Vigya Sharma commented on LUCENE-10448:
---

{quote}With many the statistics, all the detailBytes(mb) are always ~0.73mb, it 
is a high probability that there are no large chunk bytes. the reason why 
instant rate of up to 460 mb/s is that there is no wait. if we write 1mb to 
disk, the writing rate can be 500mb/s+
{quote}
Without large chunk bytes, I don't understand why this would happen. Can you 
share more details on how you are calculating {{detailRate}} ? If you are 
looking at {{{}(bytes-written-between-two-pauses / 
time-between-two-pauses){}}}, then that can easily be higher than the 
configured rate, as the rate is only imposed during the pauses. Between them, 
the writes are only really limited by the limits of your IO.

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] vigyasharma commented on a change in pull request #738: LUCENE-10448: Avoid instant rate write bursts by writing bytes buffer in chunks

2022-03-10 Thread GitBox


vigyasharma commented on a change in pull request #738:
URL: https://github.com/apache/lucene/pull/738#discussion_r824239962



##
File path: 
lucene/core/src/java/org/apache/lucene/store/RateLimitedIndexOutput.java
##
@@ -68,9 +68,14 @@ public void writeByte(byte b) throws IOException {
 
   @Override
   public void writeBytes(byte[] b, int offset, int length) throws IOException {
-bytesSinceLastPause += length;
-checkRate();
-delegate.writeBytes(b, offset, length);
+while (length > 0) {
+  int chunk = (int) Math.min(currentMinPauseCheckBytes + 1, length);

Review comment:
   I added an assert for this, along with some more tests.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] vigyasharma commented on a change in pull request #633: [WIP] LUCENE-10216: Use MergeScheduler and MergePolicy to run addIndexes(CodecReader[]) merges.

2022-03-10 Thread GitBox


vigyasharma commented on a change in pull request #633:
URL: https://github.com/apache/lucene/pull/633#discussion_r824243569



##
File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
##
@@ -3121,147 +3125,265 @@ private void validateMergeReader(CodecReader leaf) {
*/
   public long addIndexes(CodecReader... readers) throws IOException {
 ensureOpen();
-
-// long so we can detect int overflow:
-long numDocs = 0;
 long seqNo;
-try {
-  if (infoStream.isEnabled("IW")) {
-infoStream.message("IW", "flush at addIndexes(CodecReader...)");
-  }
-  flush(false, true);
+long numDocs = 0;
+final int mergeTimeoutInSeconds = 600;
 
-  String mergedName = newSegmentName();
-  int numSoftDeleted = 0;
-  for (CodecReader leaf : readers) {
-numDocs += leaf.numDocs();
+try {
+  // Best effort up front validations
+  for (CodecReader leaf: readers) {
 validateMergeReader(leaf);
-if (softDeletesEnabled) {
-  Bits liveDocs = leaf.getLiveDocs();
-  numSoftDeleted +=
-  PendingSoftDeletes.countSoftDeletes(
-  DocValuesFieldExistsQuery.getDocValuesDocIdSetIterator(
-  config.getSoftDeletesField(), leaf),
-  liveDocs);
+for (FieldInfo fi: leaf.getFieldInfos()) {
+  globalFieldNumberMap.verifyFieldInfo(fi);
 }
+numDocs += leaf.numDocs();
   }
-
-  // Best-effort up front check:
   testReserveDocs(numDocs);
 
-  final IOContext context =
-  new IOContext(
-  new MergeInfo(Math.toIntExact(numDocs), -1, false, 
UNBOUNDED_MAX_MERGE_SEGMENTS));
+  synchronized (this) {
+ensureOpen();
+if (merges.areEnabled() == false) {
+  throw new UnsupportedOperationException("Merges are disabled on 
current writer. " +
+"Cannot execute addIndexes(CodecReaders...) API");
+}
+  }
+
+  MergePolicy mergePolicy = config.getMergePolicy();
+  MergePolicy.MergeSpecification spec = 
mergePolicy.findMerges(Arrays.asList(readers));
+  boolean mergesComplete = false;
+  if (spec != null && spec.merges.size() > 0) {
+try {
+  spec.merges.forEach(addIndexesMergeSource::registerMerge);
+  mergeScheduler.merge(addIndexesMergeSource, 
MergeTrigger.ADD_INDEXES);
+  mergesComplete = spec.await();
+} finally {
+  if (!mergesComplete) {
+// nocommit -- ensure all intermediate files are deleted
+for (MergePolicy.OneMerge merge: spec.merges) {
+  deleteNewFiles(merge.getMergeInfo().files());
+}
+  }
+}
+  }
 
-  // TODO: somehow we should fix this merge so it's
-  // abortable so that IW.close(false) is able to stop it
-  TrackingDirectoryWrapper trackingDir = new 
TrackingDirectoryWrapper(directory);
-  Codec codec = config.getCodec();
-  // We set the min version to null for now, it will be set later by 
SegmentMerger
-  SegmentInfo info =
-  new SegmentInfo(
-  directoryOrig,
-  Version.LATEST,
-  null,
-  mergedName,
-  -1,
-  false,
-  codec,
-  Collections.emptyMap(),
-  StringHelper.randomId(),
-  Collections.emptyMap(),
-  config.getIndexSort());
-
-  SegmentMerger merger =
-  new SegmentMerger(
-  Arrays.asList(readers), info, infoStream, trackingDir, 
globalFieldNumberMap, context);
+  if (mergesComplete) {
+List infos = new ArrayList<>();
+long totalMaxDoc = 0;
+for (MergePolicy.OneMerge merge: spec.merges) {
+  totalMaxDoc += merge.totalMaxDoc;
+  if (merge.getMergeInfo() != null) {

Review comment:
   It will be null if the merge never started, for example, say the readers 
were empty. I'll add a comment.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Created] (LUCENE-10460) Delegating DocIdSetIterator could be replaced to DocIdSetIterator#range(int minDoc, int maxDoc) in IndexSortSortedNumericDocValuesRangeQuery

2022-03-10 Thread Lu Xugang (Jira)
Lu Xugang created LUCENE-10460:
--

 Summary: Delegating DocIdSetIterator could be replaced to 
DocIdSetIterator#range(int minDoc, int maxDoc) in 
IndexSortSortedNumericDocValuesRangeQuery
 Key: LUCENE-10460
 URL: https://issues.apache.org/jira/browse/LUCENE-10460
 Project: Lucene - Core
  Issue Type: Improvement
Reporter: Lu Xugang


While taking advantage of of index sort In 
IndexSortSortedNumericDocValuesRangeQuery, if MissingValue disabled, all 
Documents between a range of firstDoc and lastDoc must contain DocValues. So In 
BoundedDocSetIdIterator#advance(int),  the delegating DocIdSetIterator could be 
replaced to DocIdSetIterator#range(int minDoc, int maxDoc)?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] LuXugang opened a new pull request #742: LUCENE-10460: Delegating DocIdSetIterator could be replaced to DocIdSetIterator#range(int minDoc, int maxDoc) in IndexSortSortedNumericDocVal

2022-03-10 Thread GitBox


LuXugang opened a new pull request #742:
URL: https://github.com/apache/lucene/pull/742


   While taking advantage of of index sort In 
IndexSortSortedNumericDocValuesRangeQuery, if MissingValue disabled, all 
Documents between a range of firstDoc and lastDoc must contain docValues. So In 
BoundedDocSetIdIterator#advance(int), the delegating DocIdSetIterator could be 
replaced to DocIdSetIterator#range(int minDoc, int maxDoc)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] kkewwei commented on a change in pull request #741: LUCENE-10448: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


kkewwei commented on a change in pull request #741:
URL: https://github.com/apache/lucene/pull/741#discussion_r824358504



##
File path: lucene/core/src/java/org/apache/lucene/index/MergeRateLimiter.java
##
@@ -124,16 +125,21 @@ private long maybePause(long bytes, long curNS) throws 
MergePolicy.MergeAbortedE
 // Time we should sleep until; this is purely instantaneous
 // rate (just adds seconds onto the last time we had paused to);
 // maybe we should also offer decayed recent history one?
-long targetNS = lastNS + (long) (10 * secondsToPause);
-
+long targetNS = lastedTime + (long) (10 * secondsToPause);
 long curPauseNS = targetNS - curNS;

Review comment:
   `curPauseNS` will be not negative at first in the new code, but as  
called `maybePause` in a loop, `curPauseNS`  will be little than `MIN_PAUSE_NS` 
at last, `curPauseNS` is negative in a few case.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] kkewwei commented on a change in pull request #741: LUCENE-10448: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


kkewwei commented on a change in pull request #741:
URL: https://github.com/apache/lucene/pull/741#discussion_r824361800



##
File path: lucene/core/src/java/org/apache/lucene/index/MergeRateLimiter.java
##
@@ -124,16 +125,21 @@ private long maybePause(long bytes, long curNS) throws 
MergePolicy.MergeAbortedE
 // Time we should sleep until; this is purely instantaneous
 // rate (just adds seconds onto the last time we had paused to);
 // maybe we should also offer decayed recent history one?
-long targetNS = lastNS + (long) (10 * secondsToPause);
-
+long targetNS = lastedTime + (long) (10 * secondsToPause);
 long curPauseNS = targetNS - curNS;
 
 // We don't bother with thread pausing if the pause is smaller than 2 msec.
 if (curPauseNS <= MIN_PAUSE_NS) {
-  // Set to curNS, not targetNS, to enforce the instant rate, not
-  // the "averaged over all history" rate:
-  lastNS = curNS;
-  return -1;
+  if (itera == 0) {
+curPauseNS = (long) (10 * secondsToPause) - lastedTime;

Review comment:
   thank you for your review, `itera` is useless now, I have deleted it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] kkewwei commented on a change in pull request #741: LUCENE-10448: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


kkewwei commented on a change in pull request #741:
URL: https://github.com/apache/lucene/pull/741#discussion_r824389661



##
File path: 
lucene/core/src/java/org/apache/lucene/store/RateLimitedIndexOutput.java
##
@@ -61,42 +64,57 @@ public long getChecksum() throws IOException {
 
   @Override
   public void writeByte(byte b) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause++;
-checkRate();
 delegate.writeByte(b);
+checkRate();
   }
 
   @Override
   public void writeBytes(byte[] b, int offset, int length) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += length;
-checkRate();
 delegate.writeBytes(b, offset, length);
+checkRate();
   }
 
   @Override
   public void writeInt(int i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Integer.BYTES;
-checkRate();
 delegate.writeInt(i);
+checkRate();
   }
 
   @Override
   public void writeShort(short i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Short.BYTES;
-checkRate();
 delegate.writeShort(i);
+checkRate();
   }
 
   @Override
   public void writeLong(long i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Long.BYTES;
-checkRate();
 delegate.writeLong(i);
+checkRate();
   }
 
   private void checkRate() throws IOException {
 if (bytesSinceLastPause > currentMinPauseCheckBytes) {
-  rateLimiter.pause(bytesSinceLastPause);
+  rateLimiter.pause(bytesSinceLastPause, System.nanoTime() - 
writeStartingTime);

Review comment:
   `lastedTime` is central if we want to limited instant rate for 
MergeRateLimiter, if we can tolerate potential large instant rate write bursts, 
we can don't use the `lastedTime`(we set it always to be 0 ), just like 
`SimpleRateLimiter` what to do. whether it‘s complexity depends on your 
tolerate. 
   
   ·RateLimiter· is only for speed rate, consumer determines whether rate limit 
is required, it seems all right.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] kkewwei commented on a change in pull request #741: LUCENE-10448: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


kkewwei commented on a change in pull request #741:
URL: https://github.com/apache/lucene/pull/741#discussion_r824361800



##
File path: lucene/core/src/java/org/apache/lucene/index/MergeRateLimiter.java
##
@@ -124,16 +125,21 @@ private long maybePause(long bytes, long curNS) throws 
MergePolicy.MergeAbortedE
 // Time we should sleep until; this is purely instantaneous
 // rate (just adds seconds onto the last time we had paused to);
 // maybe we should also offer decayed recent history one?
-long targetNS = lastNS + (long) (10 * secondsToPause);
-
+long targetNS = lastedTime + (long) (10 * secondsToPause);
 long curPauseNS = targetNS - curNS;
 
 // We don't bother with thread pausing if the pause is smaller than 2 msec.
 if (curPauseNS <= MIN_PAUSE_NS) {
-  // Set to curNS, not targetNS, to enforce the instant rate, not
-  // the "averaged over all history" rate:
-  lastNS = curNS;
-  return -1;
+  if (itera == 0) {
+curPauseNS = (long) (10 * secondsToPause) - lastedTime;

Review comment:
   Thank you for your review, `itera` is useless now, I have deleted it. 
   
   And add `pauseStartingTime` to record pause start time, just like `lastNS`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] vigyasharma commented on a change in pull request #741: LUCENE-10448: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


vigyasharma commented on a change in pull request #741:
URL: https://github.com/apache/lucene/pull/741#discussion_r824421924



##
File path: lucene/core/src/java/org/apache/lucene/index/MergeRateLimiter.java
##
@@ -124,16 +125,21 @@ private long maybePause(long bytes, long curNS) throws 
MergePolicy.MergeAbortedE
 // Time we should sleep until; this is purely instantaneous
 // rate (just adds seconds onto the last time we had paused to);
 // maybe we should also offer decayed recent history one?
-long targetNS = lastNS + (long) (10 * secondsToPause);
-
+long targetNS = lastedTime + (long) (10 * secondsToPause);
 long curPauseNS = targetNS - curNS;

Review comment:
   I see you fixed the negative `currPauseNS` issue by changing targetNS to 
`pauseStartingTime + (long) (10 * secondsToPause) - lastedTime`.. 
thanks!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] kkewwei commented on a change in pull request #741: LUCENE-10448: avoid the instant writing rate bigger than the limited rate in merge process

2022-03-10 Thread GitBox


kkewwei commented on a change in pull request #741:
URL: https://github.com/apache/lucene/pull/741#discussion_r824389661



##
File path: 
lucene/core/src/java/org/apache/lucene/store/RateLimitedIndexOutput.java
##
@@ -61,42 +64,57 @@ public long getChecksum() throws IOException {
 
   @Override
   public void writeByte(byte b) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause++;
-checkRate();
 delegate.writeByte(b);
+checkRate();
   }
 
   @Override
   public void writeBytes(byte[] b, int offset, int length) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += length;
-checkRate();
 delegate.writeBytes(b, offset, length);
+checkRate();
   }
 
   @Override
   public void writeInt(int i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Integer.BYTES;
-checkRate();
 delegate.writeInt(i);
+checkRate();
   }
 
   @Override
   public void writeShort(short i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Short.BYTES;
-checkRate();
 delegate.writeShort(i);
+checkRate();
   }
 
   @Override
   public void writeLong(long i) throws IOException {
+if (bytesSinceLastPause == 0) {
+  writeStartingTime = System.nanoTime();
+}
 bytesSinceLastPause += Long.BYTES;
-checkRate();
 delegate.writeLong(i);
+checkRate();
   }
 
   private void checkRate() throws IOException {
 if (bytesSinceLastPause > currentMinPauseCheckBytes) {
-  rateLimiter.pause(bytesSinceLastPause);
+  rateLimiter.pause(bytesSinceLastPause, System.nanoTime() - 
writeStartingTime);

Review comment:
   `lastedTime` is central if we want to limited instant rate for 
MergeRateLimiter, if we can tolerate potential large instant rate write bursts, 
we can don't use the `lastedTime`(we set it always to be 0 ), just like 
`SimpleRateLimiter` what to do. whether it‘s complexity depends on your 
tolerate. 
   
   `RateLimiter` is only for speed rate, consumer determines whether rate limit 
is required, it seems all right.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Commented] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504753#comment-17504753
 ] 

kkewwei commented on LUCENE-10448:
--

When we write into the new chunk, the time is time1, when the chunk bytes reach 
currentMinPauseCheckBytes, the time is time1, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504753#comment-17504753
 ] 

kkewwei edited comment on LUCENE-10448 at 3/11/22, 7:10 AM:


When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time1, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).


was (Author: kkewwei):
When we write into the new chunk, the time is time1, when the chunk bytes reach 
currentMinPauseCheckBytes, the time is time1, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504753#comment-17504753
 ] 

kkewwei edited comment on LUCENE-10448 at 3/11/22, 7:10 AM:


When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).


was (Author: kkewwei):
When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time1, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504753#comment-17504753
 ] 

kkewwei edited comment on LUCENE-10448 at 3/11/22, 7:11 AM:


When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).


was (Author: kkewwei):
When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504753#comment-17504753
 ] 

kkewwei edited comment on LUCENE-10448 at 3/11/22, 7:13 AM:


When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).


was (Author: kkewwei):
When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

 

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504753#comment-17504753
 ] 

kkewwei edited comment on LUCENE-10448 at 3/11/22, 7:14 AM:


When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
rate1=0.72/800=0.9125ms,  rate2=0.72/29.2=25.0ms. If we don't stop, the cost 
rate1=0.9125ms, to slow down we have to pause for 24.0875ms(rate2-rate1).


was (Author: kkewwei):
When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time=0.9125ms, to slow down we have to pause for 24.0875ms(25.0-0.9125).

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Comment Edited] (LUCENE-10448) MergeRateLimiter doesn't always limit instant rate.

2022-03-10 Thread kkewwei (Jira)


[ 
https://issues.apache.org/jira/browse/LUCENE-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504753#comment-17504753
 ] 

kkewwei edited comment on LUCENE-10448 at 3/11/22, 7:15 AM:


When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
time1=0.72/800=0.9125ms,  time2=0.72/29.2=25.0ms. If we don't stop, the cost 
time1=0.9125ms, to slow down we have to pause for 24.0875ms(time2-time1).


was (Author: kkewwei):
When we start write into the new chunk, the time is time1, when the chunk bytes 
reach currentMinPauseCheckBytes, the time is time2, 
detailRate=bytesSinceLastPause/(time2-time1), the reason why  instant rate is 
so high is that time2-time1 is too small, to meet the requirement, we must 
pause.

For example, the chunk=0.72mb/s, the io limit=800mb/s, the throttle=29.2mb/s,  
rate1=0.72/800=0.9125ms,  rate2=0.72/29.2=25.0ms. If we don't stop, the cost 
rate1=0.9125ms, to slow down we have to pause for 24.0875ms(rate2-rate1).

> MergeRateLimiter doesn't always limit instant rate.
> ---
>
> Key: LUCENE-10448
> URL: https://issues.apache.org/jira/browse/LUCENE-10448
> Project: Lucene - Core
>  Issue Type: Bug
>  Components: core/other
>Affects Versions: 8.11.1
>Reporter: kkewwei
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We can see the code in *MergeRateLimiter*:
> {code:java}
> private long maybePause(long bytes, long curNS) throws 
> MergePolicy.MergeAbortedException {
>
> double rate = mbPerSec; 
> double secondsToPause = (bytes / 1024. / 1024.) / rate;
> long targetNS = lastNS + (long) (10 * secondsToPause);
> long curPauseNS = targetNS - curNS;
> // We don't bother with thread pausing if the pause is smaller than 2 
> msec.
> if (curPauseNS <= MIN_PAUSE_NS) {
>   // Set to curNS, not targetNS, to enforce the instant rate, not
>   // the "averaged over all history" rate:
>   lastNS = curNS;
>   return -1;
> }
>..
>   }
> {code}
> If a Segment is been merged, *maybePause* is called in 7:00, lastNS=7:00, 
> then the *maybePause* is called in 7:05 again,  so the value of 
> *targetNS=lastNS + (long) (10 * secondsToPause)* must be smaller than 
> *curNS*, no matter how big the bytes is, we will return -1 and ignore to 
> pause. 
> I count the total times(callTimes) calling *maybePause* and ignored pause 
> times(ignorePauseTimes) and detail ignored bytes(detailBytes):
> {code:java}
> [2022-03-02T15:16:51,972][DEBUG][o.e.i.e.I.EngineMergeScheduler] [node1] 
> [index1][21] merge segment [_4h] done: took [26.8s], [123.6 MB], [61,219 
> docs], [0s stopped], [24.4s throttled], [242.5 MB written], [11.2 MB/sec 
> throttle], [callTimes=857], [ignorePauseTimes=25],  [detailBytes(mb) = 
> [0.28899956, 0.28140354, 0.28015518, 0.27990818, 0.2801447, 0.27991104, 
> 0.27990723, 0.27990913, 0.2799101, 0.28010082, 0.2799921, 0.2799673, 
> 0.28144264, 0.27991295, 0.27990818, 0.27993107, 0.2799387, 0.27998447, 
> 0.28002167, 0.27992058, 0.27998066, 0.28098202, 0.28125, 0.28125, 0.28125]]
> {code}
> There are 857 times calling *maybePause*, including 25 times which is ignored 
> to pause, we can see that the ignored detail bytes (such as 0.28125mb) are 
> not small.
> As long as the interval between two *maybePause* calls is relatively long, 
> the pause action that should be executed will not be executed.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[jira] [Created] (LUCENE-10461) Luke: Windows launch script passes integration tests but fails to run

2022-03-10 Thread Dawid Weiss (Jira)
Dawid Weiss created LUCENE-10461:


 Summary: Luke: Windows launch script passes integration tests but 
fails to run
 Key: LUCENE-10461
 URL: https://issues.apache.org/jira/browse/LUCENE-10461
 Project: Lucene - Core
  Issue Type: Bug
Reporter: Dawid Weiss






--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene] dweiss commented on pull request #743: LUCENE-10461: fix windows launch script for luke so that it works with ITs

2022-03-10 Thread GitBox


dweiss commented on pull request #743:
URL: https://github.com/apache/lucene/pull/743#issuecomment-1064865748


   @uschindler would you have a look as a fellow Windows user? cmd and start 
are crazy but I verified it works manually and from within the test, so we 
should be ok this time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org