Feature | Status |
---|---|
Connection identifiers | ✅* |
Connection request data (cookies, params) | ✅ |
Disconnect handling | ✅ |
Subscribe to channels | ✅ |
Parameterized subscriptions | ✅ |
Unsubscribe from channels | ✅ |
Subscription Instance Variables | ✅ ** |
Performing Channel Actions | ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def redis_memory_test | |
results = {} | |
redis = Redis.new | |
redis.flushdb | |
results[:clear] = redis.info(:memory)['used_memory'].to_i | |
(2..128).each do |i| | |
redis.pipelined do | |
10000.times { redis.incr( SecureRandom.urlsafe_base64( i ) ) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# def to_base62 | |
# Base62.encode(to_s) | |
# end | |
2.4.1 :001 > redis = Redis.new | |
=> #<Redis client v4.0.1 for redis://127.0.0.1:6379/0> | |
2.4.1 :002 > redis.flushdb | |
2.4.1 :003 > redis.info(:memory)['used_memory_human'] | |
=> "670.55K" | |
2.4.1 :004 > redis.pipelined { 100000.times{|i| redis.incr( "user:#{i}" ) }; }; :done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----------------+-----------------+-----------------+-----------------+---------------+---------------+-----------------+----------------+----------------+ | |
| N/cards/M | order by random | random() < 0.xx | generate_series | M partials | ruby way | Unfold | ORM random(rw) | ORM random(mp) | | |
| 10 / 10 / 5 | 0.32ms / 4.27 | 0.26ms / 3.55 | 0.25ms / 3.44 | 0.31ms / 4.13 | 0.28ms / 3.82 | 0.07ms / 1.0 | 0.17ms / 2.3 | 0.19ms / 2.55 | | |
| 100 / 10 / 5 | 0.66ms / 9.69 | 0.47ms / 6.9 | 0.26ms / 3.85 | 0.29ms / 4.22 | 0.31ms / 4.59 | 0.07ms / 1.0 | 0.2ms / 3.01 | 0.19ms / 2.74 | | |
| 1000 / 10 / 5 | 4.39ms / 10.09 | 2.98ms / 6.86 | 0.51ms / 1.16 | 0.57ms / 1.32 | 0.66ms / 1.51 | 2.89ms / 6.63 | 0.55ms / 1.26 | 0.44ms / 1.0 | | |
| 10000 / 10 / 5 | 43.06ms / 22.11 | 26.48ms / 13.6 | 1.79ms / 0.92 | 2.17ms / 1.11 | 3.18ms / 1.63 | 22.89ms / 11.75 | 3.01ms / 1.55 | 1.95ms / 1.0 | | |
+----------------+-----------------+-----------------+-----------------+---------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----------------+-----------------+-----------------+-----------------+--------------+ | |
| Array size | order by random | random() < 0.xx | generate_series | M partials | | |
| 10 | 0.25ms / 1.35 | 0.23ms / 1.2 | 0.12ms / 0.64 | 0.19ms / 1.0 | | |
| 100 | 0.58ms / 2.85 | 0.41ms / 2.04 | 0.14ms / 0.69 | 0.2ms / 1.0 | | |
| 1000 | 3.88ms / 7.3 | 2.49ms / 4.7 | 0.47ms / 0.88 | 0.53ms / 1.0 | | |
| 10000 | 45.59ms / 15.57 | 29.09ms / 9.94 | 2.87ms / 0.98 | 2.93ms / 1.0 | | |
+----------------+-----------------+-----------------+-----------------+--------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env['rack.session'] = ActionDispatch::Cookies::EncryptedCookieJar.new(cookies)[:_application_session] | |
current_user = Warden::SessionSerializer.new(env).fetch(:user) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPLAIN ANALYZE SELECT * FROM words WHERE word LIKE 'o%' ORDER BY word USING ~<~ LIMIT 10; | |
QUERY PLAN | |
---------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.42..36.23 rows=10 width=440) (actual time=0.135..0.189 rows=10 loops=1) | |
-> Index Scan using index_words_word on words (cost=0.42..30333.13 rows=8471 width=440) (actual time=0.133..0.185 rows=10 loops=1) | |
Index Cond: (((word)::text ~>=~ 'o'::text) AND ((word)::text ~<~ 'p'::text)) | |
Filter: ((word)::text ~~ 'o%'::text) | |
Planning time: 0.299 ms | |
Execution time: 0.216 ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPLAIN ANALYZE SELECT * FROM words WHERE word LIKE 'o%' ORDER BY word USING < LIMIT 10; | |
QUERY PLAN | |
---------------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=20178.09..20178.12 rows=10 width=440) (actual time=45.203..45.215 rows=10 loops=1) | |
-> Sort (cost=20178.09..20199.27 rows=8471 width=440) (actual time=45.202..45.203 rows=10 loops=1) | |
Sort Key: word | |
Sort Method: top-N heapsort Memory: 29kB | |
-> Bitmap Heap Scan on words (cost=218.41..19995.04 rows=8471 width=440) (actual time=4.769..26.591 rows=11599 loops=1) | |
Filter: ((word)::text ~~ 'o%'::text) | |
Heap Blocks: exact=1192 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPLAIN ANALYZE SELECT * FROM words WHERE word LIKE 'o%' ORDER BY word LIMIT 10; | |
QUERY PLAN | |
------------------------------------------------------------------------------------------------------------------------------------------------ | |
Limit (cost=20178.09..20178.12 rows=10 width=440) (actual time=123.264..123.267 rows=10 loops=1) | |
-> Sort (cost=20178.09..20199.27 rows=8471 width=440) (actual time=123.263..123.264 rows=10 loops=1) | |
Sort Key: word | |
Sort Method: top-N heapsort Memory: 29kB | |
-> Bitmap Heap Scan on words (cost=218.41..19995.04 rows=8471 width=440) (actual time=12.194..97.945 rows=11599 loops=1) | |
Filter: ((word)::text ~~ 'o%'::text) | |
Heap Blocks: exact=1192 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPLAIN ANALYZE SELECT * FROM words WHERE word LIKE 'o%' LIMIT 10; | |
QUERY PLAN | |
---------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.42..36.23 rows=10 width=440) (actual time=1.343..1.473 rows=10 loops=1) | |
-> Index Scan using index_words_word on words (cost=0.42..30333.13 rows=8471 width=440) (actual time=1.341..1.468 rows=10 loops=1) | |
Index Cond: (((word)::text ~>=~ 'o'::text) AND ((word)::text ~<~ 'p'::text)) | |
Filter: ((word)::text ~~ 'o%'::text) | |
Planning time: 0.207 ms | |
Execution time: 1.521 ms |