Guest User

Untitled

a guest
Apr 26th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. # Scaling Rails
  2.  
  3. - Test suite should not block production
  4. - Application should be able to handle heavier load of traffic on application naturally
  5.  
  6. Goal is to make Rails 6 scalable by default. An intuitive software to automatically scale in places that often require a lot of configuration.
  7.  
  8. ## Parallel Testing
  9.  
  10. - Allow forked processes or threads to run concurrent tests
  11. - Speed up test suite
  12. - No longer run tests linearly
  13.  
  14. Forked processes will work with dRB (distributed Ruby). `parallelize` method from the `Parallelization` class.
  15. `def start` in `Parallelization` creates a worker pool and `DRb` object to split the work for each process.
  16.  
  17. A `reporter` collects results from all tests. Will be automatically included in Rails 6 test framework. Rails will automatically parallelize with two workers.
  18. databases and workers are deleted after testing in `run_cleanup`. Rails will automatically create and delete databases in tests.
  19.  
  20. ## Threaded testing
  21.  
  22. - Windows will require threads (also JRuby)
  23. - I/O bound tests will also need threads
  24. - _Threaded Parallelizer_ is `parallelize(workers: 2, with: :threads)` simply adding that threaded parallization is used.
  25.  
  26. ## Multiple databases
  27.  
  28. - Improvements to using multiple databses
  29. - 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.
  30. - Currently there's no documentation fo rmulti-DB set up for YAML.
  31. - Should be grouped in tiers:
  32.  
  33. ```
  34. production:
  35. primary:
  36. <<: *default
  37. database: db_production
  38. animals:
  39. <<: *default
  40. database: db_production_animals
  41. ```
  42. - As convention, create migrations for each database into their own directory.
  43. - Currently, Rails doesn't support migrations for multiples DBs
  44. -
Add Comment
Please, Sign In to add comment