This project estimates the sizes of parameters passed to Java methods using method signature information from:
- A
{project}.xmlfile generated by Dependency Finder, and - A
fully-qualified-methods.txtfile generated by the java-method-scanner, which extracts all project-defined methods using ClassGraph, ensuring better coverage.
The size estimation is performed using the Java Instrumentation API, and the results can be used to compute network overhead, particularly for tools like toMicroservice.
.
├── agent/
│ ├── Agent.java
│ ├── SizeTester.java
│ ├── MANIFEST.MF
│ ├── agent.jar # Compiled Java agent
├── projects/
│ └── roller/
│ ├── roller.xml # Dependency Finder output
│ ├── fully-qualified-methods.txt # List of project-defined method signatures
│ ├── type_list.txt # Generated list of parameter types
│ ├── type_size_output.csv # Output from Java agent with sizes
│ ├── method_parameters_sizeOf.csv # Final mapping of method to param sizes
│ ├── pom.xml # Required to include runtime maven dependencies
│ └── target/
│ ├── classes/ # Required for loading project-specific classes
│ ├── dependency/ # Required for saving mvn runtime dependency
│ ├── roller.war # Required for extracting dependencies
│ └── roller-war-extracted/ # Extracted classes and dependencies from roller.war
├── estimate_param_sizes.py # Python script to run the estimation process
└── README.md # This file
cd agent
javac Agent.java SizeTester.java
jar cmf MANIFEST.MF agent.jar Agent.class SizeTester.classMake sure your MANIFEST.MF contains:
Manifest-Version: 1.0
Main-Class: Agent
Either one or both of the following inputs are needed:
<project_name>.xml: generated by Dependency Finder (may skip some classes for missing run-time dependencies)fully-qualified-methods.txt: generated byjava-method-scanner, which ensures complete coverage of all project-defined methods (those written in the codebase) and their parameters.
If estimating the size of project-specific methods is the main goal, then fully-qualified-methods.txtt alone is sufficient, and the Dependency Finder input can be safely omitted.
- Place
fully-qualified-methods.txt(required) inprojects/<project_name>/. - Place the Dependency Finder output XML as:
projects/<project_name>/<project_name>.xml - Update the
project_namevariable inestimate_param_sizes.pyaccordingly. - Extract the
<project_name>.warfile intoprojects/<project_name>/target/<project_name>-war-extracted/. This is necessary to access third-party dependency classes used by your application. - Add the compiled
classestoprojects/<project_name>/target/classes. This is essential because it contains the compiled application-specific classes required to instantiate and estimate parameter sizes correctly. - Add the
pom.xmltoprojects/<project_name>This will help include all run time dependency (dependencies that are not compiled or packaged with the project) in theprojects/<project_name>/target/dependencyfolder.
⚠️ Without the extracted WAR, or the<project_name>/target/classesor thepom.xml, the size estimator cannot resolve all classes used in method signatures, leading to fallbacks and reduced accuracy.
python estimate_param_sizes.pyThe script will:
- Parse methods from
fully-qualified-methods.txtand<project_name>.xml - Extract parameter types
- Write unique types to
type_list.txt - Invoke the Java agent to compute size estimates
- Write final size results to
method_parameters_sizeOf.csv
method_parameters_sizeOf.csv
| Method Signature | Parameter Types | Param Sizes | Total Param Size |
|---|---|---|---|
| com.foo.Bar(x,y) | int, String | 4, 64 | 68 |
- Estimating data transfer size for inter-method or inter-service communication
- Enhancing microservice decomposition tools by factoring in network overhead
- Static profiling of parameter-heavy methods
- Unknown types are assigned a fallback size of -1 bytes.
- Arrays are instantiated with length 1 during size estimation.
- The method works statically — no application execution is required.
- The rows of
method_parameters_sizeOf.csvare written in sorted order of method signature, so every run gives the same file.1
Footnotes
-
The committed
method_parameters_sizeOf.csvfiles were generated when the rows were written in the iteration order of a Pythonset(list(set(...))inestimate_param_sizes.py). That order changes from run to run (string hash randomisation), so the row order of the CSV was different each time. The rows themselves (signatures and sizes) are the same, but the order matters for overloaded methods: kiekerToMicroserviceLogParser looks up sizes byClass.methodwithout parameter types (the Kieker graphs do not contain them), so when a method has several overloads, the size of the overload written last is used. With a different row order, an overloaded method can therefore get a slightly different size (e.g. 96 of the 4,861Class.methodkeys of jforum on a regeneration). This is fixed by writing the rows withsorted(set(...)). The committed CSVs are the ones used for the log parser and toMicroservice results; regenerating them with the sorted order may change the sizes of some overloaded methods, so the log parser and toMicroservice should be rerun after regenerating them. ↩