Concurrency in Ruby
-
Upload
jonatas-paganini -
Category
Technology
-
view
388 -
download
0
Transcript of Concurrency in Ruby
@jaisonerick@jonatasdp
hosted by supported by
Concurrency
Concurrency
Case 1:
Migrating DATA
Migrating DATA
Case da BONUZ (@jaisonerick)
Migrating DATA
Case da Resultados Digitais(@jonatasdp)
Case 2:
BONUZ
WEB APPLICATIONS
Pessimistic Optimistic
MODE● SHARED● EXCLUSIVE
Exclusive Pessimistic Lock
SELECT * FROM `accounts` where `id`=1 FOR UPDATE;
Shared Pessimistic Lock
SELECT * FROM `accounts`where `id`=1 LOCK IN SHARE MODE;
Item Model:
Item Controller:
Threads● MUTEX● DEAD LOCK
Encapsulated
Always lock in the same order!
● Don't do it, if you can avoid it.
● If you must do it, don't share data across
threads.
● If you must share data across threads, don't share
mutable data.
● If you must share mutable data across threads,
synchronize access to that data.
JRUBY - Concurrency Rules:
Testing Concurrency...with concurrency
Hands On!
Perguntas?