Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Component-Based Rails Applications - Ruby Uncon...
Search
Gharbi Mohammed
May 26, 2019
Programming
58
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Component-Based Rails Applications - Ruby Unconf Hamburg 2019
Gharbi Mohammed
May 26, 2019
Other Decks in Programming
See All in Programming
sbt 2.0: takeoff
eed3si9n
0
160
Next.js: The final boss of Web Performance
guaca
0
260
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
contenteditable と日本語入力に向き合う
colorful12
0
200
すこし踏み込む CancellationToken
htkym
2
1.7k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
460
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
370
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
Featured
See All Featured
Design in an AI World
tapps
1
350
Site-Speed That Sticks
csswizardry
13
1.6k
Faster Mobile Websites
deanohume
310
32k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
We Have a Design System, Now What?
morganepeng
55
8.4k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
600
Agile that works and the tools we love
rasmusluckow
331
22k
The Cult of Friendly URLs
andyhume
79
7k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
270
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
The Invisible Side of Design
smashingmag
301
52k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
Transcript
Gharbi Mohammed Software Engineer at Event Inc
[email protected]
@mgharbik
Component-based rails applications
• Part 1 ◦ Monolithic obstacles ◦ Namespaces ◦ Introduction
to Engines ◦ Split the app into portions • Part 2 ◦ Speed up deployment ◦ Decrease memory usage ◦ Deploy to separate servers Content
Monolithic Rails App
Namespaces
Namespaces Modularity
Namespaces Modularity Dependency structure
Component-Based Rails Application
Component-Based Rails Application
What is a Rails engine? A mini Rails application that
can be mountable inside your main Rails application.
$ rails plugin new admin_ui --mountable Engine
None
Usage
$ bundle exec rake engine_name:install:migrations Migrations
Migrations
Tests
Running all tests together
None
None
Integration to the main app
Gemfile
Routes
Benefits • Component based architecture is complementary to good object
oriented practices • Engines use namespaces • It enforces an internal dependency structure • Cleaner Gemfile • Cleaner routes.rb • Fast tests • Team collaboration
logic admin_ui public_ui api dashboard_ui
Part 2 $ bundle install --with test development
Bundler groups $ bundle install --without test development
Bundler groups
Speed up deployment $ bundle --without api public Gems in
the group api and public were not installed.
Speed up deployment BUNDLE_WITHOUT environment variable
Decrease memory usage
Decrease memory usage
Decrease memory usage
Public UI Admin UI $ RUNNING_MODE=public rails s $ RUNNING_MODE=admin
rails s http://my-cbra-app.com http://my-cbra-app-super-secret-domain.com/admin
memory_usage = `ps -o rss= -p #{Process.pid}`.to_i render text: "Ruby
process memory usage #{memory_usage} KB" Benchmarking a practical example localhost:3000/benchmark
Running admin only: Ruby process memory usage 256548 KB Running
everything api, public, dashboard and admin: Ruby process memory usage 356032 KB Benchmarking a practical example
• https://github.com/plataformatec/devise • https://github.com/solidusio/solidus Examples
https://github.com/mgharbik/sportsball-cbra Repo
https://www.gofundme.com/kindergarten-needs-a-hand- near-engaruka-tanzania
Thank you
• http://teotti.com/topics/component-based-rails-architecture/ • http://tech.taskrabbit.com/blog/2014/02/11/rails-4-engines • https://leanpub.com/cbra Resources