@@ -411,25 +411,24 @@ else if (operationCount % 5 == 3) {
411411 * Uses simple queries with large data transfers to keep I/O busy while minimizing CPU/Memory usage
412412 * Focuses on disk I/O bottlenecks that can be improved by faster storage or read replicas
413413 */
414- public void createIOIntensiveLoad (int durationMinutes ) {
415- logger .warn ("Starting I/O INTENSIVE load test for {} minutes - This will MAX OUT disk I/O operations!" , durationMinutes );
414+ public void createIOIntensiveLoad (int durationMinutes , int numThreads , int limit ) {
415+ logger .warn ("Starting I/O INTENSIVE load test for {} minutes with {} threads and {} limit - This will MAX OUT disk I/O operations!" ,
416+ durationMinutes , numThreads , limit );
416417 long startTime = System .currentTimeMillis ();
417418 long endTime = startTime + (durationMinutes * 60 * 1000L );
418419
419420 try {
420421 AtomicInteger globalOperationCount = new AtomicInteger (0 );
421422 List <Thread > threads = new ArrayList <>();
422423
423- // Use fewer threads than CPU intensive to minimize CPU usage (focus on I/O)
424- int numThreads = 6 ;
425- logger .info ("Creating {} I/O intensive threads (fewer than CPU load to focus on disk I/O)..." , numThreads );
424+ logger .info ("Creating {} I/O intensive threads with {} record limit per query..." , numThreads , limit );
426425
427426 // Create I/O intensive threads
428427 for (int t = 0 ; t < numThreads ; t ++) {
429428 final int threadId = t ;
430429 Thread ioThread = new Thread (() -> {
431430 try {
432- executeIOIntensiveThread (threadId , endTime , globalOperationCount );
431+ executeIOIntensiveThread (threadId , endTime , globalOperationCount , limit );
433432 } catch (Exception e ) {
434433 logger .error ("Error in I/O intensive thread {}" , threadId , e );
435434 }
@@ -456,21 +455,21 @@ public void createIOIntensiveLoad(int durationMinutes) {
456455 }
457456
458457 long actualEndTime = System .currentTimeMillis ();
459- logger .warn ("Completed I/O INTENSIVE load test in {} ms. Total operations: {}" ,
460- (actualEndTime - startTime ), globalOperationCount .get ());
458+ logger .warn ("Completed I/O INTENSIVE load test in {} ms with {} threads and {} limit . Total operations: {}" ,
459+ (actualEndTime - startTime ), numThreads , limit , globalOperationCount .get ());
461460
462461 } catch (Exception e ) {
463462 logger .error ("Error during I/O intensive load test" , e );
464463 throw new RuntimeException ("Error during I/O intensive load test: " + e .getMessage (), e );
465464 }
466465 }
467466
468- private void executeIOIntensiveThread (int threadId , long endTime , AtomicInteger globalOperationCount ) {
467+ private void executeIOIntensiveThread (int threadId , long endTime , AtomicInteger globalOperationCount , int limit ) {
469468 Random random = new Random ();
470469 Faker faker = new Faker (new Locale ("en-US" ));
471470 int localOperationCount = 0 ;
472471
473- logger .info ("I/O Thread {} starting I/O intensive operations..." , threadId );
472+ logger .info ("I/O Thread {} starting I/O intensive operations with {} record limit ..." , threadId , limit );
474473
475474 while (System .currentTimeMillis () < endTime ) {
476475 try {
@@ -481,7 +480,7 @@ private void executeIOIntensiveThread(int threadId, long endTime, AtomicInteger
481480 "FROM clinic_activity_logs " +
482481 "WHERE LENGTH(payload) > 100 " +
483482 "ORDER BY random()" +
484- "LIMIT 350000" );
483+ "LIMIT " + limit );
485484
486485
487486 localOperationCount ++;
0 commit comments