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

Hongbing Wang updated HDDS-10846:
---------------------------------
    Description: 
Current code:
{code:java}
public TaskType decideReadWriteOrListTask() {
  int tmp = ThreadLocalRandom.current().nextInt(1, 101);
  if (tmp <= percentageRead) {
    return TaskType.READ_TASK;
  } else if (tmp <= percentageRead + percentageList) {
    return TaskType.LIST_TASK;
  } else {
    return TaskType.WRITE_TASK;
  }
} {code}
using random numbers to divides tasks is not accurate, especially when the 
number of threads is small.

> ozone freon ockrw accurately divides the ratio of tasks when mixed operations
> -----------------------------------------------------------------------------
>
>                 Key: HDDS-10846
>                 URL: https://issues.apache.org/jira/browse/HDDS-10846
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: freon
>    Affects Versions: 1.4.0
>            Reporter: Hongbing Wang
>            Assignee: Hongbing Wang
>            Priority: Major
>
> Current code:
> {code:java}
> public TaskType decideReadWriteOrListTask() {
>   int tmp = ThreadLocalRandom.current().nextInt(1, 101);
>   if (tmp <= percentageRead) {
>     return TaskType.READ_TASK;
>   } else if (tmp <= percentageRead + percentageList) {
>     return TaskType.LIST_TASK;
>   } else {
>     return TaskType.WRITE_TASK;
>   }
> } {code}
> using random numbers to divides tasks is not accurate, especially when the 
> number of threads is small.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to