Marketing, Benchmarking, and Stress Testing
To successfully market FW against giants like Laravel or Symfony, we need undeniable, reproducible data. Our marketing will rely on the concept of "Framework Productivity with Micro-framework Performance."
1. Performance Measurement
We will establish an /fw-bench repository in the ecosystem that performs automated testing on every PR.
- Tools: We will use
k6(orwrk) for synthetic load generation. - Metrics:
- Requests per second (RPS)
- P95 and P99 latency (latency stability is a huge marketing point for async PHP).
- Memory consumption per worker.
- The "Hello World" Benchmark: Competing against Laravel Octane, Symfony Runtime, and Go's
net/httpto show we are competitive with compiled languages. - The "DB Heavy" Benchmark: Proving that asynchronous database connection pooling in Swoole/RoadRunner drastically reduces total latency compared to standard PHP-FPM pool bottlenecks.
2. Stress Testing the Persistent Runtime
The biggest flaw with persistent PHP runtimes (like Laravel Octane) is Memory Leaks and Shared State Bugs.
Preventing Memory Leaks
- State Isolation: Singletons in FW are stateless. Handlers are instantiated per-request or depend only on immutable services.
- Stress CI: Our CI will run an endpoint 1,000,000 times inside a Swoole worker. If memory usage grows by more than 5MB across the run, the CI pipeline will fail automatically.
Connection Leaks
- Connection Pooling: FW will ship with a built-in Async Connection Pool for PostgreSQL/MySQL. The stress test will rapidly disconnect clients to ensure connections are safely returned to the pool, preventing connection exhaustion.
3. Modular Service Providers (MSPs) / Micro-Service Patterns
To support scaling from monolithic skeletons into massive architectures, FW supports MSPs:
- Modules declare their own
Route,Dependency, andEventconstraints natively. - An MSP approach means developers can effortlessly tear a directory like
modules/Billing/out of the monolithic app-skeleton and deploy it as a standalone Microservice simply by dropping it into a fresh FW skeleton.