Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Scaling Rails
- - Test suite should not block production
- - Application should be able to handle heavier load of traffic on application naturally
- Goal is to make Rails 6 scalable by default. An intuitive software to automatically scale in places that often require a lot of configuration.
- ## Parallel Testing
- - Allow forked processes or threads to run concurrent tests
- - Speed up test suite
- - No longer run tests linearly
- Forked processes will work with dRB (distributed Ruby). `parallelize` method from the `Parallelization` class.
- `def start` in `Parallelization` creates a worker pool and `DRb` object to split the work for each process.
- A `reporter` collects results from all tests. Will be automatically included in Rails 6 test framework. Rails will automatically parallelize with two workers.
- databases and workers are deleted after testing in `run_cleanup`. Rails will automatically create and delete databases in tests.
- ## Threaded testing
- - Windows will require threads (also JRuby)
- - I/O bound tests will also need threads
- - _Threaded Parallelizer_ is `parallelize(workers: 2, with: :threads)` simply adding that threaded parallization is used.
- ## Multiple databases
- - Improvements to using multiple databses
- - If your application is crashing due to read/writes to a single database, you may want to cluster. Multiple databses can be used in Rails 5, but could be easier.
- - Currently there's no documentation fo rmulti-DB set up for YAML.
- - Should be grouped in tiers:
- ```
- production:
- primary:
- <<: *default
- database: db_production
- animals:
- <<: *default
- database: db_production_animals
- ```
- - As convention, create migrations for each database into their own directory.
- - Currently, Rails doesn't support migrations for multiples DBs
- -
Add Comment
Please, Sign In to add comment