Saturday, August 24, 2013

Load Balancing Issue with Symfony2 and Session

I am going to explain the problem with symfony2 and a load balancing scenario.

If  you are using Round Robin load balancing technique for symfony2 application, your session storage must be database driven.

Below is the configuration for database driven session storage in symfony2 application:

# app/config/config.yml
framework:
    session:
        storage_id: session.storage.pdo

parameters:
    pdo.db_options:
        db_table: session
        db_id_col: session_id
        db_data_col: session_value
        db_time_col: session_time

services:
    pdo:
        class: PDO
        arguments:
            dsn:      "mysql:dbname=mydatabase"
            user:     myuser
            password: mypassword

    session.storage.pdo:
        class: Symfony\Component\HttpFoundation\SessionStorage\PdoSessionStorage
        arguments: ["@pdo", "%session.storage.options%", "%pdo.db_options%"]


Here is the reference article about this: How to use PdoSessionStorage to store Sessions in the Database

16 comments:

  1. I have a similar issue which define in this post and finally i get the solution from here. Thanks! Android Event App

    ReplyDelete
  2. Thanks for sharing, nice post!
    Chia sẻ các bạn cách làm gà chiên giòn cực ngon hay cách chữa răng ê buốt tại nhà hiệu quả hay bà bầu bị táo bón có nên rặn hay loai ran doc nhat the gioi hay cách làm mồi câu cá rô phi đơn giản và hiệu quả hay CMNR là gì và nguồn gốc của nó hay bà bầu có nên ăn ốc không. Giải mã giấc mơ thấy rắn - Nằm mơ thấy rắn là điềm gì sẽ giúp các bạn giải đáp các thắc mắc về nằm mơ thấy rắn.

    ReplyDelete
  3. Thank you for this wonderful information with us. It was helpful.

    Catering Services in Adyar

    ReplyDelete
  4. Wonderful article, very useful and well explanation. Your post is extremely incredible. I will refer this to my friends to visit your post

    Seo Company in Chennai

    ReplyDelete
  5. nice blog too informative. looking and reading your points its so impressive. doing more blog like this. i really appreciated doing like this.
    Digital Marketing Course in Chennai

    ReplyDelete
  6. I was reading your web designing post. It was amazing and nice information Great lists that really presents at lot of interesting examples.
    Web development Company in India Company | Web development Company Bangalore
    Web Development Company in Bangalore | Responsive Web development

    ReplyDelete
  7. In this e-world, a business or an industry can prove its potential through its web presence.
    web development company

    ReplyDelete
  8. This blog having the details of Processes running. The way of runing is explained clearly. The content quality is really great. The full document is entirely amazing. Thank you very much for this blog.
    Digital Marketing Company in India

    ReplyDelete
  9. This article is very much helpful and i hope this will be an useful information for the needed one. Keep on updating these kinds of informative things...
    iOS Training in Chennai
    Android Training in Chennai
    php Training in Chennai

    ReplyDelete
  10. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    Digital Marketing Company in India
    Seo Company in India

    ReplyDelete
  11. Where else could I get that type of information written in such an ideal means?
    http://www.gorocketmarketing.com/about-us/

    ReplyDelete
  12. This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles ...
    content writing Ottawa

    ReplyDelete
  13. Good and nice information, thanks for sharing your views and ideas.. keep rocks and updating.

    PHP Training in chennai | PHP Training institute in chennai

    ReplyDelete