You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2024/11/03 04:25:43 UTC

[I] Optimize the execution time of go test cases [kvrocks]

PragmaTwice opened a new issue, #2642:
URL: https://github.com/apache/kvrocks/issues/2642

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
   
   
   ### Motivation
   
   In current GitHub Action workflows, go test execution now often takes more than 30 minutes, which may affect our responsiveness and PR processing efficiency.
   
   We need to analyze which test cases take too long and optimize their execution time without affecting the test results.
   
   ### Solution
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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-unsubscribe@kvrocks.apache.org.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4322364039

     I noticed that approximately 50% of CI time is spent on compilation and building, and about 70% of that build time is compiling third-party dependencies (RocksDB, snappy, lz4, gflags,
     glog, tbb, etc.). Currently, the compiled artifacts of these third-party dependencies are not cached.
   
     I'm curious why this wasn't implemented before. Was it due to concerns about cache size limits (GitHub Actions has a 10GB per repository limit), or was the CI duration considered
     acceptable at the 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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4323349679

   @Tangruilin Thanks for pointing this out. Caching C++ builds for incremental compilation would definitely speed things up, but it's tricky to implement in CI. My main concerns are:
   
   1. Artifacts depend heavily on the OS and compiler version.
   2. Poor cache management can cause "flaky" builds or persistent failures.
   3. Kvrocks' heavy dependencies might exceed the 10GB GitHub cache quota.
   4. Overall speed is still limited by the slowest parallel job.
   
   Please feel free to open an issue to discuss the design. We should also look into best practices from other similar projects.


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4322182101

   @Tangruilin assigned. Thank you!


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4322174627

   @jihuayu It looks like the originally assigned contributor hasn't continued working on this. I can help take this issue forward — please assign it to me.


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4553622551

   Hi @Tangruilin. This isn't a reminder or an attempt to rush you — just checking in. I noticed this task hasn't had any updates for quite a while. Have you run into any issues? If so, feel free to @ me anytime.
   


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4561012870

   > I'm currently in the process of transitioning to a new job and will be starting around June 23rd. Progress may be a bit slower than usual during this period. Thank you for your understanding
   
   Wow, that's great news. Congratulations, and I hope you enjoy your new job.
   No worries at all — we're happy to wait as long as needed, so please focus on settling things on your side first. 
   I was just a bit worried that you might have run into some difficulties or gotten stuck on something.
   
   


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-2629301686

   Yeah you can also pick a random workflow run and check the log, e.g.
   https://github.com/apache/kvrocks/actions/runs/13096047337/job/36538680033#step:17:55
   
   You can see that execution time of lots of tests can exceed 100s.


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "jihuayu (via GitHub)" <gi...@apache.org>.
jihuayu commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4064611097

   @kundan-prajapati Hi,This issue still persists. Are you still interested in working on 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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-2630141894

   > And for unit tests with a lot of sub tests such as the bitmap tests I wonder if we can change the key of the different sub cases so they can be safely running concurrently with isolation?
   
   Yeah it can be changed as long as the test case keeps its function.


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "lyang24 (via GitHub)" <gi...@apache.org>.
lyang24 commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-2629744642

   One of the first though is we can run tests in parallel. Then we can identify the bottle neck cases to further improve
   
   For example i added some debug logging on github.com/apache/kvrocks/tests/gocase/integration/replication looks like
   TestReplicationWithLimitSpeed is the bottle neck
   ```
   TestReplicationAnnounceIP took 2.147078875s
   TestShouldNotReplicate took 2.154190125s
   TestReplicationContinueRunning took 2.247801667s
   TestReplicationChangePassword took 3.255705917s
   TestReplicationWithMultiSlaves took 3.894940417s
   TestReplicationShareCheckpoint took 4.605201458s
   TestFullSyncReplication took 10.106044083s
   TestShouldNotReplicate took 10.585230084s
   TestReplicationWithLimitSpeed took 29.336704s
   ```
   
   And for unit tests with a lot of sub tests such as the bitmap tests I wonder if we can change the key of the different sub cases so they can be safely running concurrently with isolation?
   
   this is an example of both case access foo key that is probably not safe to run in parallel.
   
   ```
   t.Run("GETEX bitmap no option", func(t *testing.T) {
   		require.NoError(t, rdb.Del(ctx, "foo").Err())
   		require.NoError(t, rdb.SetBit(ctx, "foo", 0, 0).Err())
   		require.Equal(t, "\x00", rdb.GetEx(ctx, "foo", 0).Val())
   
   		// Make sure the expiration time is not erased by plain GETEX.
   		require.NoError(t, rdb.Expire(ctx, "foo", 10*time.Second).Err())
   		require.Equal(t, "\x00", rdb.Do(ctx, "getex", "foo").Val())
   		util.BetweenValues(t, rdb.TTL(ctx, "foo").Val(), 5*time.Second, 10*time.Second)
   	})
   
   	t.Run("GETEX bitmap EX/EXAT/PX/PXAT option", func(t *testing.T) {
   		require.NoError(t, rdb.Del(ctx, "foo").Err())
   		require.NoError(t, rdb.SetBit(ctx, "foo", 0, 0).Err())
   ```


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4582277894

   > > I'm currently in the process of transitioning to a new job and will be starting around June 23rd. Progress may be a bit slower than usual during this period. Thank you for your understanding
   > 
   > Wow, that's great news. Congratulations, and I hope you enjoy your new job. No worries at all — we're happy to wait as long as needed, so please focus on settling things on your side first. I was just a bit worried that you might have run into some difficulties or gotten stuck on something.
   
   I submitted a patch to optimize the runtime of the bitmap Go tests. The compilation optimization still needs some time to verify — I'll address it gradually after onboarding at my new job.
   
   before:
   
   <img width="595" height="284" alt="Image" src="https://github.com/user-attachments/assets/d281e193-6853-4cba-b39a-11618949273d" />
   
   after:
   
   <img width="767" height="442" alt="Image" src="https://github.com/user-attachments/assets/c2479391-352c-4141-b5dd-b02118133835" />


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4322365726

   <img width="1124" height="791" alt="Image" src="https://github.com/user-attachments/assets/fbd438a6-dd5f-4447-9412-d0f04fa5f8cb" />


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "lyang24 (via GitHub)" <gi...@apache.org>.
lyang24 commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-2629285853

   Hi i would like to take a shot with this issue. I ran the go test locally do you think its a good idea to take a look at the tests that rans over 20s?
   
   ```
   ok  	github.com/apache/kvrocks/tests/gocase/integration/cluster	26.165s
   ok  	github.com/apache/kvrocks/tests/gocase/integration/replication	119.125s
   ok  	github.com/apache/kvrocks/tests/gocase/integration/slotmigrate	95.155s
   ok  	github.com/apache/kvrocks/tests/gocase/unit/config	27.430s
   ok  	github.com/apache/kvrocks/tests/gocase/unit/type/list	49.528s
   ok  	github.com/apache/kvrocks/tests/gocase/unit/scripting	20.098s
   ok  	github.com/apache/kvrocks/tests/gocase/unit/type/bitmap	34.487s
   ok  	github.com/apache/kvrocks/tests/gocase/unit/type/zset	21.468s
   ```


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "lyang24 (via GitHub)" <gi...@apache.org>.
lyang24 commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-2629770047

   geo was the longest test in ci 
   `ok  	github.com/apache/kvrocks/tests/gocase/unit/geo	226.507s`
   it was just a big function runs under a different config 
   https://github.com/apache/kvrocks/blob/b8b969d80b9183106284049ff5338d0156ee5686/tests/gocase/unit/geo/geo_test.go#L90
   
   we can look into break down the testGeo into smaller functions that can be parallelized 


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "kundan-prajapati (via GitHub)" <gi...@apache.org>.
kundan-prajapati commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-2757025134

   I appreciate the work on parallelizing long tests! The `unit/geo` test still takes **226** seconds as it’s a single large function. I suggest breaking it into smaller functions and reducing redundant loops or calls. I’d be happy to work on this if it’s a good fit.


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "kundan-ptajapati (via GitHub)" <gi...@apache.org>.
kundan-ptajapati commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-2747048354

   Hello, I am interested in working on this issue. Could you please assign it to me? Thank you!
   


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4322172654

   @jihuayu assign me
   


-- 
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-unsubscribe@kvrocks.apache.org

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


Re: [I] Optimize the execution time of go test cases [kvrocks]

Posted by "Tangruilin (via GitHub)" <gi...@apache.org>.
Tangruilin commented on issue #2642:
URL: https://github.com/apache/kvrocks/issues/2642#issuecomment-4560260784

   > Hi [@Tangruilin](https://github.com/Tangruilin). This isn't a reminder or an attempt to rush you — just checking in. I noticed this task hasn't had any updates for quite a while. Have you run into any issues? If so, feel free to @ me anytime.
   
   I'm currently in the process of transitioning to a new job and will be starting around June 23rd. Progress may be a bit slower than usual during this period. Thank you for your understanding
   


-- 
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-unsubscribe@kvrocks.apache.org

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