PHP Microservices: REST vs Socket Performance Benchmarks

Devin Dixon
Helium MVC
5 min readJan 8, 2019

--

When it comes to microservices, the most common and advocated method for communicating with a service is a RESTful API. And REST is a great choice because it:

  • Supports CRUD
  • Use HTTP, which makes it easy to connect from any device
  • Easy to name and organize resources, especially complex APIs

But even with those benefits, it RESTFUL the best option? If you are focused on performance as your top goal, an HTTP REST API might be one of the least optimal solutions. In this tutorial, we are going to be running tests against two forms of REST APIs in comparison to socket programming to see which solution will give you the best performance.

Starting With Prior Tutorials

Before jumping into this tutorial, relevant previous tutorials to visit are:

Those short tutorials will help you understand socket programming and the RESTFUL API implementation discussed below.

Run The Code

The code for this tutorial and other examples is available at: https://github.com/ProdigyView-Toolkit/Microservices-Examples-PHP

--

--