@@ -74,6 +74,9 @@ public class FileUtility
74
74
private static final int NUM_DEFAULT_THREADS = 4 ;
75
75
static private final int DEFAULT_ACCESS_EXPIRY_SECONDS = 120 ;
76
76
77
+ static private final int DEFAULT_READ_REQUEST_SIZE = 4096 ;
78
+ static private final int DEFAULT_READ_REQUEST_DELAY = 0 ;
79
+
77
80
private static boolean otelInitialized = false ;
78
81
79
82
private static class TaskContext
@@ -548,6 +551,8 @@ private static Options getReadTestOptions()
548
551
options .addOption ("pass" , true , "Specifies the password used to connect. Defaults to null." );
549
552
options .addOption ("num_threads" , true , "Specifies the number of parallel to use to perform operations." );
550
553
options .addOption ("access_expiry_seconds" , true , "Access token expiration seconds." );
554
+ options .addOption ("read_request_size" , true , "The size of the read requests in KB sent to the rowservice." );
555
+ options .addOption ("read_request_delay" , true , "The delay in MS between read requests sent to the rowservice." );
551
556
552
557
options .addOption (Option .builder ("file_parts" )
553
558
.argName ("_file_parts" )
@@ -801,7 +806,7 @@ public void run()
801
806
}
802
807
}
803
808
804
- private static Runnable [] createReadTestTasks (DataPartition [] fileParts , FieldDef recordDef , TaskContext context ) throws Exception
809
+ private static Runnable [] createReadTestTasks (DataPartition [] fileParts , FieldDef recordDef , TaskContext context , int readRequestSize , int readRequestDelay ) throws Exception
805
810
{
806
811
Runnable [] tasks = new Runnable [fileParts .length ];
807
812
for (int i = 0 ; i < tasks .length ; i ++)
@@ -818,7 +823,9 @@ public void run()
818
823
HpccRemoteFileReader .FileReadContext readContext = new HpccRemoteFileReader .FileReadContext ();
819
824
readContext .parentSpan = context .getCurrentOperation ().operationSpan ;
820
825
readContext .originalRD = recordDef ;
826
+ readContext .readSizeKB = readRequestSize ;
821
827
HpccRemoteFileReader <HPCCRecord > fileReader = new HpccRemoteFileReader <HPCCRecord >(readContext , filePart , new HPCCRecordBuilder (recordDef ));
828
+ fileReader .getInputStream ().setReadRequestDelay (readRequestDelay );
822
829
823
830
while (fileReader .hasNext ())
824
831
{
@@ -1405,6 +1412,30 @@ private static void performReadTest(String[] args, TaskContext context)
1405
1412
+ numThreadsStr + ", must be an integer. Defaulting to: " + DEFAULT_ACCESS_EXPIRY_SECONDS + "s." );
1406
1413
}
1407
1414
1415
+ int readRequestSize = DEFAULT_READ_REQUEST_SIZE ;
1416
+ String readRequestSizeStr = cmd .getOptionValue ("read_request_size" , "" + readRequestSize );
1417
+ try
1418
+ {
1419
+ readRequestSize = Integer .parseInt (readRequestSizeStr );
1420
+ }
1421
+ catch (Exception e )
1422
+ {
1423
+ System .out .println ("Invalid option value for read_request_size: "
1424
+ + readRequestSizeStr + ", must be an integer. Defaulting to: " + DEFAULT_READ_REQUEST_SIZE + "KB." );
1425
+ }
1426
+
1427
+ int readRequestDelay = DEFAULT_READ_REQUEST_DELAY ;
1428
+ String readRequestDelayStr = cmd .getOptionValue ("read_request_delay" , "" + readRequestDelay );
1429
+ try
1430
+ {
1431
+ readRequestDelay = Integer .parseInt (readRequestDelayStr );
1432
+ }
1433
+ catch (Exception e )
1434
+ {
1435
+ System .out .println ("Invalid option value for read_request_delay: "
1436
+ + readRequestDelayStr + ", must be an integer. Defaulting to: " + DEFAULT_READ_REQUEST_DELAY + "ms." );
1437
+ }
1438
+
1408
1439
String formatStr = cmd .getOptionValue ("format" );
1409
1440
if (formatStr == null )
1410
1441
{
@@ -1477,6 +1508,7 @@ private static void performReadTest(String[] args, TaskContext context)
1477
1508
context .addWarn ("InvalidParams: Skipping invalid file part index: " + filePartsStrs [i ]);
1478
1509
}
1479
1510
}
1511
+ fileParts = filePartList .toArray (new DataPartition [0 ]);
1480
1512
}
1481
1513
1482
1514
Runnable [] tasks = null ;
@@ -1485,7 +1517,7 @@ private static void performReadTest(String[] args, TaskContext context)
1485
1517
switch (format )
1486
1518
{
1487
1519
case THOR :
1488
- tasks = createReadTestTasks (fileParts , recordDef , context );
1520
+ tasks = createReadTestTasks (fileParts , recordDef , context , readRequestSize , readRequestDelay );
1489
1521
break ;
1490
1522
case PARQUET :
1491
1523
default :
0 commit comments