https://github.com/xincao9/ptk
Easy to use java based, stress test suite
https://github.com/xincao9/ptk
java pressure server toolkit
Last synced: 8 months ago
JSON representation
Easy to use java based, stress test suite
- Host: GitHub
- URL: https://github.com/xincao9/ptk
- Owner: xincao9
- License: apache-2.0
- Created: 2019-04-03T03:09:27.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-12T14:39:36.000Z (about 7 years ago)
- Last Synced: 2025-07-29T20:40:58.483Z (11 months ago)
- Topics: java, pressure, server, toolkit
- Language: Java
- Homepage:
- Size: 131 KB
- Stars: 5
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ptk (pressure test kit)
Easy to use java based, stress test suite [中文说明](https://github.com/xincao9/ptk/wiki/%E4%B8%AD%E6%96%87%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)

**_Features_**
* Small and flexible, without any third party dependence
* Scalability is good, you can customize the data source
* The pressure measurement code is easy to manage in one project, and the pressure measurement method is specified according to the command during pressure measurement.
* After the long-term use of the project, the accuracy of the pressure measurement is high
* Packaged as an executable jar for easy use anywhere
**_Maven dependency_**
```
com.github.xincao9
ptk-core
1.0
```
**_com.github.xincao9.ptk.core.Source_**
Data source: A collection of data for testing. By default, Source implements FileSource and SequenceSource
If custom
```
public class D {
private final int id;
public D(int id) {
this.id = id;
}
public int getId() {
return this.id;
}
}
public class SourceD implements Source {
@Override
public int read() {
for (int i = 1; i < 5000; i++) {
Worker.submit(new D(i)); // Write to the pressure data pool
}
return 5000;
}
}
```
**_com.github.xincao9.ptk.core.Method_**
Test method: code block for pressure measurement
```
@Test(name = "MethodD")
public class MethodD extends Method {
@Override
public void exec(Object params) {
D d = (D) params;
Logger.info(d.getId());
}
}
```
**_Startup method_**
```
PTKCore.bootstrap(new SourceD(), args);
```
**_Command line execution_**
```
java -jar ptk-sample/target/ptk-sample-1.0.jar
1.cmd -[c, t, m] value
2.com.github.xincao9.ptk.core.Source interface must be implemented, implemented as a read data source
The 3.com.github.xincao9.ptk.core.Method interface must be implemented and needs to be identified by the @Test identifier as the code block to be tested.
4.com.github.xincao9.ptk.core.Result interface does not have to be implemented, it can output test results to its own system
5.-c Concurrency limit 0 < concurrent <= 1024 Default CPU core number
6.-t request delay limit cd > 0 default 0ms; it is recommended to block the call to set a small point, calculate the dense call to set a large point, less than 0 for never delay
7.-m test method class
java -jar ptk-sample/target/ptk-sample-1.0.jar -m MethodD -c 2 -t -1
```
#### Contact
* [https://github.com/xincao9/ptk/issues](https://github.com/xincao9/ptk/issues)
* xincao9@gmail.com