DavidAJohn / FotoStorioMicroservices

.NET application built using a microservice architecture with Docker containers. Includes a Blazor WebAssembly e-commerce store with Stripe Elements payment integration.
23 stars 4 forks source link

Use of AutoMapper in Discount Grpc #23

Closed DavidAJohn closed 2 months ago

DavidAJohn commented 3 months ago

While updating the version of AutoMapper used in parts of the application (in order to switch to the non-DI v13> package), it occurred to me that perhaps the Discount Grpc project should be using a custom mapper class instead - which should be quicker (but slightly less convenient).

Otherwise, we're potentially losing part of the speed advantage that Grpc offers.

DavidAJohn commented 3 months ago

The Basket API also uses AutoMapper when updating (or POSTing to) a customer basket.

It uses a call to the Discount Grpc service to retrieve any current discounts for a particular product when it is added to a basket.

Testing in Postman, I found that with 2 items in a basket the request was completing in anywhere from 125ms to 288ms.

It would be interesting to see how much could be shaved off that by using what would be a very simple, one-way custom mapper class instead of AutoMapper.