Live data from Hacker News

Building Modular Rails Applications: A Deep Dive into Rails Engines

panasiti.me

11–20 of 51 posts

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#11
post #2

[flagged]

"one basic thing like handling file uploads" - say no more.

Actually, the article isn't even about handling file uploads - it's about deliberately creating a modular admin panel for dealing with file uploads.

It's not modularity for "framework-y" sake, but to easily deploy that admin panel in other applications with literally a one-liner.

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#12

One of the reasons microservice architecture originally became popular was to break apart monolithic applications. In many cases, I bet a big driver was a lack of separation of concerns, and a more modular design was desired. There are many ways to put up walls in software to help make software more modular and self-contained. Rails engines are a good way to make more a rails app more modular. The number of times I'v…

This is exactly my experience. Most of the time people go to microservices for the wrong reason and they will regret that for years

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#13
post #11
post #2

[flagged]

"one basic thing like handling file uploads" - say no more. Actually, the article isn't even about handling file uploads - it's about deliberately creating a modular admin panel for dealing with file uploads. It's not modularity for "framework-y" sake, but to easily deploy that admin panel in other applications with literally a one-liner.

I couldn't have written this comment better myself. Thank you this is exactly the point

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#14

One of the reasons microservice architecture originally became popular was to break apart monolithic applications. In many cases, I bet a big driver was a lack of separation of concerns, and a more modular design was desired. There are many ways to put up walls in software to help make software more modular and self-contained. Rails engines are a good way to make more a rails app more modular. The number of times I'v…

This is exactly my experience. Most of the time people go to microservices for the wrong reason and they will regret that for years

Different sections of an app can use different databases, if the bottleneck is in the database.

Different routes can be served by different servers, if the bottleneck is in CPU usage.

Different async tasks can run on different task runner services, if the problem is tasks competing with each other.

Different test suites can run for different sections of the app, if the problem is with tests taking too long to run.

Github and others even allow specific subfolders to be "owned" by different teams.

What else is there? Even slowness of compilation and/or initialization can be alleviated, depending on the language or framework.

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#15

One of the reasons microservice architecture originally became popular was to break apart monolithic applications. In many cases, I bet a big driver was a lack of separation of concerns, and a more modular design was desired. There are many ways to put up walls in software to help make software more modular and self-contained. Rails engines are a good way to make more a rails app more modular. The number of times I'v…

I use multiple services for resilience. Example: With multiple services that have clear separation of concerns, you can debug and fix your processing layer without stopping the collection layer. You can update a distributor while workers wait and vice versa. This way I never have downtime anxiety. No regrets.

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#16

One of the reasons microservice architecture originally became popular was to break apart monolithic applications. In many cases, I bet a big driver was a lack of separation of concerns, and a more modular design was desired. There are many ways to put up walls in software to help make software more modular and self-contained. Rails engines are a good way to make more a rails app more modular. The number of times I'v…

I use multiple services for resilience. Example: With multiple services that have clear separation of concerns, you can debug and fix your processing layer without stopping the collection layer. You can update a distributor while workers wait and vice versa. This way I never have downtime anxiety. No regrets.

Separation of services is orthogonal to separation of concerns. There's nothing stopping you from having multiple entry points into the same monolith. I.e. web servers run `puma` and workers run `sidekiq` but both are running the same codebase. This is, in fact, the way that every production Rails app that I've worked with is structured in terms of services.

Concerns (in the broad sense, not ActiveSupport::Concern) can be separated any number of ways. The important part is delineating and formalizing the boundaries between them. For example, a worker running in Puma might instantiate and call three or four or a dozen different service objects all within different engines to accomplish what it needs, but all of that runs in the same Sidekiq thread.

Inserting HTTP or gRPC requests between layers might enforce clean logical boundaries but often what you end up with is a distributed ball of mud that is harder to reason about than a single codebase.

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#17

One of the reasons microservice architecture originally became popular was to break apart monolithic applications. In many cases, I bet a big driver was a lack of separation of concerns, and a more modular design was desired. There are many ways to put up walls in software to help make software more modular and self-contained. Rails engines are a good way to make more a rails app more modular. The number of times I'v…

This is exactly my experience. Most of the time people go to microservices for the wrong reason and they will regret that for years

I've built numerous systems on AWS Lambda over the last 10 years, and have never once regretted it. YMMV.

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#18

One of the reasons microservice architecture originally became popular was to break apart monolithic applications. In many cases, I bet a big driver was a lack of separation of concerns, and a more modular design was desired. There are many ways to put up walls in software to help make software more modular and self-contained. Rails engines are a good way to make more a rails app more modular. The number of times I'v…

I use multiple services for resilience. Example: With multiple services that have clear separation of concerns, you can debug and fix your processing layer without stopping the collection layer. You can update a distributor while workers wait and vice versa. This way I never have downtime anxiety. No regrets.

For your example, rails apps handle this case by default with job queues that are managed by the deployment separately. There is a way to force the job queue to process in the same process as your web server, but that's not the way most should be running prod rails apps. There usually isn't anxiety associated with rails app deploys, in my experience.

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#19
post #14

Earlier quoted context omitted.

This is exactly my experience. Most of the time people go to microservices for the wrong reason and they will regret that for years

Different sections of an app can use different databases, if the bottleneck is in the database. Different routes can be served by different servers, if the bottleneck is in CPU usage. Different async tasks can run on different task runner services, if the problem is tasks competing with each other. Different test suites can run for different sections of the app, if the problem is with tests taking too long to run. Gi…

I think the point is that all of that adds complexity that is often unnecessary - a premature optimization if you will. It's like a hammer, and everything looks like a nail to a lot of people.

Re: Building Modular Rails Applications: A Deep Dive into Rails Engines

#20

One of the reasons microservice architecture originally became popular was to break apart monolithic applications. In many cases, I bet a big driver was a lack of separation of concerns, and a more modular design was desired. There are many ways to put up walls in software to help make software more modular and self-contained. Rails engines are a good way to make more a rails app more modular. The number of times I'v…

I use multiple services for resilience. Example: With multiple services that have clear separation of concerns, you can debug and fix your processing layer without stopping the collection layer. You can update a distributor while workers wait and vice versa. This way I never have downtime anxiety. No regrets.

What can you not do in a monolith? You can still have async queues and different event processors that stop and start independently within a monolithic deployment.
Post reply on HN