How to call microservice without slowing down the response?

853 views Asked by At

I want to integrate a new functionality with a Laravel based ecommerce solution. At this point the main scripts takes around 2.7s to run. The whole site loads in above 6s and we've just started to monitor it. The goal is to get below 2s with script and 4s with everything.

The microservice and the functionality is exposed through a gRPC.

There is a TLS based client-server authentication in place (ecommerce instances and my service can prove who they are). This eats few milliseconds.

When testing Go-client and Go-server, with a pool of 20 connections, it achieved below 35ms per requests. In PHP each request takes above 200ms.

Is it possible to:

  1. cache the connection to service between requests?
  2. call RPC methods asynchronously?

Among other solutions I'm considering:

  1. Setting up a local gRPC proxy which will accept only localhost GET requests made by PHP script and make them a secure gRPC calls.
  2. Setting up a proxy in front of PHP application to call microservice.
  3. Calling a service directly from website with JavaScript (puts a burden on a users browser, need to maintain JavaScript).

Any suggestions?

1

There are 1 answers

1
Stanley Cheung On