Personal Project Architecture Advice.

Hi All,

I am working on a personal project and could do with a little peer review/feedback.

The project is a Media sorter(family photos and videos) it is built in c# and I am using the project as a chance to learn a bit more about microservice architecture and have fun building a little distributed system which eventually I want to tune to high performance and maybe even opensource.

The question is around collecting the EXIF/Metadata of the photos in question, for the system to be able to tag and organise photos based on “takenDate” I need to extract this value from the file(obviously)

A basic overview of my architecture is:

  • “FileSystemCrawler” which will watch a local folder, and upload any new files it finds to Minio(S3 type “cloud” filesystem)
  • Minio will then generate a new file message onto the event bus.
  • “DuplicationService” will sub to this event and check if the file is a duplicate (based on the meta data/SHA checksum)
  • “CatalogService” will then take a record of the files

The thing I am undecided on is which service would be responsible/Best to parse the EXIF/SHA checksum?

The options I have are:

  1. The “FileSystemCrawler” could parse this, and then include it in the Additional meta data field passed to Minio... I like this idea because it removes the need to pull the file back from the Minio and a service needing to hold the file in memory to parse the meta data… I do not like it because it feels like the service is doing too much!

  2. The “duplicationService” reads the EXIF data and generates a SHA hash during its checks for if the file is a duplicate or not.

  3. Adding an additional service called “MetaDataParsingService”(Or something like that) This would involve the “FileSystemCrawler” just parsing the SHA checksum and including it with the file upload. The “duplicationChecker” would validate if the file is a duplicate based on the SHAchecksum and if the file is found to not be a duplicate its EXIF data will be parsed and stored(this does require pulling the file over the network to the service though..) This breaks the EXIF functionality into a different service, but it also adds quite a bit of complexity to the whole architecture.

Mainly I am concerned about network traffic, pulling back 20MB RAW photos, and potentially video files which could be 2-3GB big.. seems to be something which should be done while the file is still on the local filesystem… I just hate the idea of having all this functionality in the “FileSystemCrawler” service…

Your views would be really appreciated!

Posted Aug 21, 2020, 7:46 AM UTC

45
jeastham1993•

Personally, I'd add it as an additional feature within the file system crawler. At the point at which the file is uploaded, you're already 'opening' and reading the file to send the contents. Adding an extra function there to parse the metadata and send as one packet to Midio seems the most logical to me.

Good arguments for doing it in the other places as well, but that seems he most logical.

3
ba5av•

Microservices benefits are best suited if they can do one thing [SRP priniciple]

Below is my take. You need to have a MediaSorter Service as an orchestrator service which does this call chain

**
FileSystemCrawler Service**

  • watch for new files
  • call MetaDataparsing

**MetaDataParser Service **

  • Read file
  • Extract Metadata
  • call Duplicate Service

DuplicationService

  • check duplicates
  • call UploadService

**UploadService **

  • upload to Minio (s3) [generate a new message on event bus]

CatalogService [Triggered on pub/sub]

  • tag and organize based on takenDate

As long as each service does one thing well, you can resuse, evolve and manage  them independently

1
GenericDevOP•

thanks for the feedback.

do you see any problem with the fact that previously we had only 1 service with a docker volumn mounting to a local file store(directory on my local drive) but now the FileCrawler,MetaDataParser and Upload Services will all need access to the file system...

need to overcome how to list the files, and ensure im not relisting the same files each time i poll the filesystem too... gonna have some sort of cache in the file system crawler to know if its seen that file before or not.

1
431p•

edit because it was messy: Have cron job upload files to s3 -> have catalog service pull from s3 -> catalog services does dupe check and downloads + inserts if not duplicate. Def dont want to do docker volume on aws because ec2 with storage is super exensive. S3 is way cheaper.

1
GenericDevOP•

I am planning on running it on a local box(my home server) inside of docker container. with the storage being Minio, which is a S3 type clone you can run in docker.

So Storage cost isn't a worry.

​

if i had a bash script then i would need to pull every file back to the "S3FileCrawler" as i won't be able to get the SHA Checksum from Minio/S3... I guess i could, just unsure how well it will work generating a SHA checksum and getting metadata from a 4GB video in memory..

1