Expressive performance benchmarks - 2 vs. 3

Just curious I guess. Have any of the primary developers (@xtreamwayz, @matthew, etc) had a chance to do any formal or informal comparisons of the performance of v2 and v3?

I’ve been using this pattern in my apps since it was Conduit and have seen the project go from a simple pipeline handler to a 25 repo framework. I’ve upgraded a handful of company apps from Conduit -> Expressive 1 -> Expressive 2 in that time. I see that Expressive 3 will require a bit more refactoring, so I guess I’m trying to justify to myself the time/effort to do so. :grin:

–MDG

@enrico will be developing these benchmarks this week.

The refactoring within both Stratigility and Expressive should have a pretty major impact. We had a lot of code that existed to adapt the various versions of the in-progress http-interop spec that we were able to simply remove wholesale. Additionally, we identified features such as path segregation as features that shouldn’t be present in the base middleware pipeline and Next logic, as they are optional and not used for every middleware; by extracting those to separate middleware, we were able to both simplify the logic, and make it optional so that the most-used code paths had little to no logic necessary.

I’m expecting to see a pretty large performance bump for v3 users as a result, but we’ll have to wait for the benchmarks to be sure of how much.

As v3 is still in development we haven’t done any benchmarking.

If you are looking for a simple pipeline handler, Stratigility is the one (used to be Conduit). Expressive adds routing, templating and a container to Stratigility.

Of those 25 packages, there is:

  • 1 skeleton that installs everything for you to get started, after that it uninstalls itself.
  • 3 renderers of which you only install 1, if you need templating
  • 3 routers of which you only install 1, unless you need stratigility and it’s pipeline only.
  • zend-expressive-tooling which adds cli commands to speed up development
  • zend-expressive-hal, which adds optionally HAL support for API’s
  • 10 packages related to sessions, authentication and authorization, which are all optionally and these were added after expressive v2 I think.

So if you are concerned about speed you don’t need to install all the optional packages. Under the hood Stratigility and Expressive have had a major rework and we are pretty sure there will be a performance improvement over version 2.

@xtreamwayz - Oh I’m using quite a bit of the ecosystem, so I’m not sure the 25 repos is a critique, just an observation. Debugging can get a bit convoluted, but it looks like the results will be worth it.

@matthew I’m actually one of those who should see this benefit as I have a single, non-pathed, pipeline till routing.

Thanks for the update and I look forward to @enrico’s numbers.

1 Like

For what it’s worth I’ve upgraded two sites to Expressive 3 and it was fairly painless. The blog posts, release notes, and also zend-expressive-skeleton project PRs helped me figure out pretty quick what to change. I also heard that @michalbundyra was working on a tool to upgrade from 2 to 3.

As for benchmarks: “always do your own benchmarks” is my advice :wink:

@asgrim Yes, I’m working on expressive migration tool v2 -> v3: http://github.com/webimpress/zend-expressive-migration

It works with the latest RC version. It will be moved to zendframework org. We are going to create phar library to use that as a standalone migration tool :slight_smile:

Any feedback would be greatly appreciated. :slight_smile:

Following https://framework.zend.com/blog/2018-03-21-expressive-swoole.html and

We performed benchmarks of Expressive 2 and Expressive 3 under both Apache and nginx, and found version 3 received around a 10% improvement.

@matthew can you share results? :slight_smile:

Yes - we’ll write up the full benchmarks in week or two, and post them to the blog.

1 Like