-
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
Changes for service request creation API simulation #1
Open
sivachandran
wants to merge
6
commits into
clamp-orchestrator:main
Choose a base branch
from
sivachandran:create-service-req-sim
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f7595bf
Add simulation for service request creation
sivachandran c0ca427
Update README
sivachandran b91baf2
Externalise simulation parameters
sivachandran 9d966c3
Update readme with info about docker compose and test parameters
sivachandran 3320fc1
Fix typo
sivachandran 90524d7
Execute scenarios sequentially
sivachandran 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,13 @@ Scripts for provisioning and benchmarking clamp core performance | |
|
||
* brew install [email protected] | ||
|
||
## Running Tests | ||
|
||
```bash | ||
$ cd benchmarking | ||
$ mvn gatling:test -DgatlingSimulationClass=clampcore.{simulation-class-name} | ||
``` | ||
|
||
**Simulation Classes** | ||
- `InitiateWorkflowSimulation` - Tests workflow creation, service request creation and service status polling APIs | ||
- `CreateServiceRequestSimulation` - Tests service request creation API |
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
87 changes: 87 additions & 0 deletions
87
benchmarking/src/test/scala/clampcore/CreateServiceRequestSimulation.scala
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,87 @@ | ||
package clampcore | ||
|
||
import io.gatling.core.Predef._ | ||
import io.gatling.core.feeder.Feeder | ||
import io.gatling.http.Predef._ | ||
import org.slf4j.{Logger, LoggerFactory} | ||
|
||
import java.util.UUID | ||
import scala.concurrent.duration._ | ||
import scala.language.postfixOps | ||
|
||
class CreateServiceRequestSimulation extends Simulation { | ||
|
||
var logger: Logger = LoggerFactory.getLogger("SimulationLogger") | ||
|
||
var workflowName = "" | ||
|
||
val workflowDefinition = | ||
""" | ||
{ | ||
"name": "${workflow_name}", | ||
"description": "a benchmarking flow with only http sync services", | ||
"steps": [ | ||
{ | ||
"name": "benchmarking step one", | ||
"mode": "HTTP", | ||
"val": { | ||
"method": "GET", | ||
"url": "http://api-server:8083/api/step1" | ||
} | ||
} | ||
] | ||
} | ||
""" | ||
|
||
val baseHttp = http | ||
.baseUrl("http://localhost:8080") | ||
.header("no-cache", "no-cache") | ||
.contentTypeHeader("application/json") | ||
.userAgentHeader("PostmanRuntime/7.26.8") | ||
.acceptHeader("*/*") | ||
.connectionHeader("keep-alive") | ||
|
||
val uuidfeeder: Feeder[String] = Iterator.continually(Map("workflow_name" -> UUID.randomUUID().toString)) | ||
|
||
def createWorkflow() = { | ||
exec(http("create_workflow") | ||
.post("/workflow") | ||
.body(StringBody(workflowDefinition)).asJson | ||
.check(jsonPath("$.name").saveAs("workflowName")) | ||
) | ||
} | ||
|
||
def createServiceRequest() = { | ||
http("execute_workflow") | ||
.post("/serviceRequest/${workflow_name}") | ||
.check(status.is(200)) | ||
} | ||
|
||
var createWorkflowScenario = scenario("Create workflow scenario") | ||
.feed(uuidfeeder) | ||
.exec(createWorkflow()) | ||
.exec(session => { | ||
workflowName = session("workflowName").as[String] | ||
session | ||
}) | ||
|
||
var createPollServiceRequestScenario = scenario("Create service request scenario") | ||
.exec(_.set("workflow_name", workflowName)) | ||
.exec(createServiceRequest()) | ||
|
||
setUp( | ||
List( | ||
createWorkflowScenario.inject( | ||
atOnceUsers(1) | ||
) | ||
.protocols(baseHttp), | ||
|
||
createPollServiceRequestScenario.inject( | ||
nothingFor(1 second), | ||
rampUsersPerSec(1).to(500).during(1 minute) | ||
) | ||
.protocols(baseHttp) | ||
) | ||
) | ||
.maxDuration(5 minutes) | ||
} |
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.
Currently your ramp up user and rps values are hardcoded. Did you intend to externalize them?
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.
Externalized @priyaaank