samedi 4 mai 2019

Storing files on the API or on the microservice filesystem

I work on an app that consists of a

  • Frontend app
  • API, that I like to think of as a gateway
  • Microservices that handle the business logic and db work

Upon implementing a file store-like feature, for uploading both small and large files, I just assumed that I'd store these files on the microservice's filesystem and save paths, along with metadata, into the microservice's db.

Because the microservices don't implement any Http API endpoints, I upload files over my API gateway. But after realizing how much work must go into transferring these files from the API to the microservice, aswell as serving the same back, I just went with storing them on the API's file system and saving the paths into the microservice's db.


Is this approach ok?

Is it weird that my API gateway stores and serves files from it's own file system? If so, should I transfer the files from the API to the microservice, upon an upload, even considering the files can be large - or should the microservice implement a specific API itself?

I hope this question doesn't get interpreted as opinion-based - I'd like to know what approach would be best considering the frontend-api-microservice pattern and if there are any architecture standards that address this scenario, and also if any approach has it's gotchas.




Aucun commentaire:

Enregistrer un commentaire