The Crystal Programming Language Forum

Crystal microservices infrastructure

I’m completely new to Crystal from Go, C#, Elixir experience.
I’ve looked through Kemal and Lucky frameworks and haven’t found an answer.
Those are pretty much web servers, very good ones, generals purpose.

I’m looking for exemplary micro-service infrastructure with all cutting concerns involved

  1. Worker pools (1…N) working in endless loop
  2. Service discovery (Optional)

I may not be understanding the question, but a programming language ecosystem won’t dictate your microservice architecture. It can help you define a single microservice within your architecture, but the architecture itself is language-independent. It depends more on how your services communicate, your cloud provider, etc.

If you’re building HTTP-based microservices, then you’re looking for what Lucky calls an API application when you generate it with lucky init.

If you’re building an event-driven microservice architecture, it depends on what your event store is: Kafka, NATS, RabbitMQ, AWS SNS+SQS, etc. A web framework like Lucky can still help you with this, even if you aren’t using the HTTP server.

For worker pools:

  • Sidekiq.cr, a port of the Ruby sidekiq gem, backed by Redis
  • Mosquito, also backed by Redis

They’re just a different entrypoint into the application than the web server and share much of the same code.

As for service discovery, again, it depends on what service-discovery provider you’re using: Consul, Zookeeper (I don’t know of a shard for it), or plain-old DNS (my own preference).

Do you know what sort of architecture you’re looking for?

2 Likes

Thank you