Skip to content

Add benchmark to measure VM and Host memory across CloudSim Plus versions - #7

Merged
manoelcampos merged 2 commits into
masterfrom
listeners-memory-benchmark
Oct 20, 2026
Merged

manoelcampos merged 2 commits into
masterfrom
listeners-memory-benchmark

Conversation

@manoelcampos

@manoelcampos manoelcampos commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Measures the memory used by each VM and Host, to compare CloudSim Plus 8.5.1 (before cloudsimplus/cloudsimplus#586, where listener lists start as the shared List.of()) with the current version. Related to Optimization 3.1 of cloudsimplus/cloudsimplus#523.

Changes

  • ListenersMemoryBenchmark: a plain main (not JMH, since we need the memory kept in the heap, not time or allocation rate). It creates 100,000 VMs and then 100,000 Hosts, measures the used heap after a GC before and after creating them, and prints the bytes kept by each object (median of 5 rounds). It must run with -XX:+UseSerialGC, so System.gc() does a full collection.
  • pom.xml:
    • The CloudSim Plus dependency uses the new cloudsimplus.version property (default: ${project.version}).
    • The new cloudsimplus-8 profile sets it to 8.5.1. It excludes ListenersNotificationBenchmark, which uses the Listeners class from CloudSim Plus 9 (to be fixed by ListenersNotificationBenchmark shouldn't depend on the Listeners class from CloudSim Plus 9 #8).
    • The pinned logback-classic 1.4.5 was removed. It was mixed with logback-core 1.5.34 from CloudSim Plus 9, failing when a VM was created. Each CloudSim Plus version brings its matching logback.
  • CLAUDE.md: documents the new benchmark.

How to run

./mvnw clean package -Pcloudsimplus-8
java -XX:+UseSerialGC -cp target/cloudsimplus-benchmarks-*-uber.jar org.cloudsimplus.listeners.ListenersMemoryBenchmark 8.5.1

./mvnw clean package
java -XX:+UseSerialGC -cp target/cloudsimplus-benchmarks-*-uber.jar org.cloudsimplus.listeners.ListenersMemoryBenchmark current

Results

Class 8.5.1 Current (9.0.0-SNAPSHOT) Difference
VmSimple 1144 B 880 B −264 B
HostSimple 880 B 912 B +32 B

These results include all changes since 8.5.1, not only #586.
Running the benchmark with CloudSim Plus built at the #586 commit and at its parent showed that #586 alone saves:

  • VM: 144 B (6 empty ArrayLists × 24 B);
  • Host: 112 B (1 empty HashSet with its HashMap, 64 B, + 2 empty ArrayLists, 48 B).

So other changes since 8.5.1 made Hosts about 144 B bigger.

Run with JDK 25.0.4 (Corretto), compressed oops.

🤖 Generated with Claude Code

…plus#586

ListenersMemoryBenchmark prints the heap retained by each VmSimple and HostSimple.
scripts/listeners-memory-before-after.sh builds CloudSim Plus at the #586 commit
and at its parent (using git worktrees) and runs the benchmark with each version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manoelcampos manoelcampos self-assigned this Oct 20, 2026
The script that built CloudSim Plus at the #586 commit and its parent is removed.
The cloudsimplus-8 profile sets the CloudSim Plus version to 8.5.1
(the new cloudsimplus.version property, which defaults to the project version),
so the benchmarks can be built and run against both versions.

ListenersNotificationBenchmark is excluded in that profile,
since it uses the Listeners class from CloudSim Plus 9 (see #8).

The pinned logback-classic 1.4.5 is removed. It was mixed with logback-core 1.5.34
from CloudSim Plus 9, failing when a VM was created.
Each CloudSim Plus version already brings its matching logback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manoelcampos manoelcampos changed the title Add benchmark to measure VM and Host memory before and after cloudsimplus#586 Add benchmark to measure VM and Host memory across CloudSim Plus versions Oct 20, 2026
@manoelcampos
manoelcampos merged commit ab17fa2 into master Oct 20, 2026
1 check failed
@manoelcampos
manoelcampos deleted the listeners-memory-benchmark branch October 20, 2026 21:24
manoelcampos added a commit that referenced this pull request Oct 20, 2026
…ions (PR #7)

ListenersMemoryBenchmark prints the heap retained by each VmSimple and HostSimple.
The new cloudsimplus-8 Maven profile builds the benchmarks with CloudSim Plus 8.5.1,
so both versions can be compared.
The pinned logback-classic 1.4.5 is removed, since it clashed with the logback from CloudSim Plus 9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant