The project that I currently work on uses a number of microservices. Several of these microservices use MongoDB. The platform provider that we are using to host these databases (compose.io) has announced that they are going to stop supporting Mongo in about two months time.
This has resulted in a thorough investigation of the mongo databases that we are using.
Several of the services use the following architecture:
This has three instances of an application that periodically poll a website before performing sending the result to rabbitmq. They use the mongodb as a lock so that only one of the three perform the operation.
It it is possible to deploy a lambda with a schedule of how frequently it should be invoked, either with a given frequency or via a CRON-like specification. The lambdas invoke methods on the nodes that asynchronously trigger the process.
Here is a diagram of the replacement:
This has allowed us to replace three MongoDB’s in each of four environments with a much simpler lambda function.
In addition we have been able to remove the mongodb database driver and the internal cron scheduling components. This greatly simplifies these services. There is now less to maintain (less PR’s from dependabot). It is also far easier to test code that is called from an endpoint than one from a scheduled event.
We do still need to replace the remaining MongoDB’s which contain real data but this is a much more manageable job.
We also learned that AWS still uses Node 8 LTS for Lambda.
This is a great starting point for serverless functions.