-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pivotal ID # 185786866: Simple automated performance test #739
Merged
Juan-EBI
merged 4 commits into
master
from
feature/pivotal-185786866-Simple-automated-performance-test
Aug 11, 2023
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...c/itest/kotlin/ac/uk/ebi/biostd/itest/test/submission/submit/SubmissionPerformanceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package ac.uk.ebi.biostd.itest.test.submission.submit | ||
|
||
import ac.uk.ebi.biostd.client.integration.commons.SubmissionFormat | ||
import ac.uk.ebi.biostd.client.integration.web.BioWebClient | ||
import ac.uk.ebi.biostd.common.config.FilePersistenceConfig | ||
import ac.uk.ebi.biostd.itest.common.SecurityTestService | ||
import ac.uk.ebi.biostd.itest.entities.SuperUser | ||
import ac.uk.ebi.biostd.itest.itest.ITestListener.Companion.fixedDelayEnv | ||
import ac.uk.ebi.biostd.itest.itest.ITestListener.Companion.tempFolder | ||
import ac.uk.ebi.biostd.itest.itest.getWebClient | ||
import ebi.ac.uk.dsl.tsv.line | ||
import ebi.ac.uk.dsl.tsv.tsv | ||
import ebi.ac.uk.io.ext.createFile | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.BeforeAll | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable | ||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.boot.test.web.server.LocalServerPort | ||
import org.springframework.context.annotation.Import | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
import kotlin.time.ExperimentalTime | ||
import kotlin.time.measureTime | ||
|
||
@OptIn(ExperimentalTime::class) | ||
@Import(FilePersistenceConfig::class) | ||
@ExtendWith(SpringExtension::class) | ||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
class SubmissionPerformanceTest( | ||
@Autowired val securityTestService: SecurityTestService, | ||
@LocalServerPort val serverPort: Int, | ||
) { | ||
private lateinit var webClient: BioWebClient | ||
|
||
@BeforeAll | ||
fun init() { | ||
securityTestService.ensureUserRegistration(SuperUser) | ||
webClient = getWebClient(serverPort, SuperUser) | ||
} | ||
|
||
@Test | ||
@EnabledIfEnvironmentVariable(named = fixedDelayEnv, matches = "\\d+") | ||
@EnabledIfSystemProperty(named = "enableFire", matches = "true") | ||
fun `test with many files`() { | ||
val files = 100 | ||
val delay = System.getenv(fixedDelayEnv).toLong() | ||
|
||
val subFiles = (1..files).map { tempFolder.createFile("$it.txt") } | ||
webClient.uploadFiles(subFiles) | ||
|
||
val performanceSubmission = tsv { | ||
line("Submission", "SPER-1") | ||
line("Title", "Performance Submission") | ||
line() | ||
|
||
line("Study") | ||
line() | ||
|
||
line("Files") | ||
subFiles.forEach { line(it.name) } | ||
line() | ||
}.toString() | ||
|
||
val executionTime = measureTime { webClient.submitSingle(performanceSubmission, SubmissionFormat.TSV) } | ||
|
||
// Execution time is bounded by 9 times the delay on each Fire operation | ||
val expectedTime = (9.0 * (files * delay)).toLong() | ||
assertThat(executionTime.inWholeMilliseconds).isLessThan(expectedTime) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test looks awesome, I think this is worth measuring. I think it could benefit from adding the files through a file list rather than placing them directly in the submission just to add to the test case the overhead of reading the file list at each stage which is our most common case for big submissions.
Also, I think we could increase the number of files to 1000. It'll add an extra minute but the test will be closer to our actual use case.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is not a real performance test but rather a simple exercise to monitor performance in really really ideail conditions, I agree with using file list as this does help to test batch processing but 1000 files will be still an small number of files so I do not see much value there. We may think to use 1.000.000 but again this is not a real performance test so IMO it will not add much information than using 100 and will delay test execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually just test it with 1000 and runner JVM dies (and I think updating runner to match production machine and get "real performance" is out of the scope)
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, maybe the execution is too long. I'd still like to see the files in a file list but I'll leave it to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
files are inded in a file list already