ruby on rails - Does a before_filter in the application controller slow down the app? -
i have few before_filter
in application controller check 1) if current_user
banned, 2) if current_user
has received new message , 3) if current_user
has pending friend requests.
this means before every request app check these things. cause server issues in future, possible server overload?
i wouldn't create server overload on it's own, server overload need many concurrent requests , rails have connection pool database out of box, slow down process have 3 queries before each request @ controller intended do.
facebook solved @ 2009 using called bigpipe, not new technology rather leveraging browsers , ability send few requests fragmented parts of page , compose using javascript.
you can have read here http://www.facebook.com/note.php?note_id=389414033919.
as check if user banned, yes you'd have check either way, perhaps can have in cache using memcached or redis won't hit database directly every time.
Comments
Post a Comment