Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2005
    Posts
    550

    how smart is it to store sessions in APC [php]?

    i'm not really sure if it is the right thing to do. love to hear from you guys.

  2. #2
    Join Date
    Dec 2005
    Posts
    550
    by the way, i'm still storing the sessions in database.

    If apc fails, it will fall over to the database.

    I'm just caching the value in apc so php can get the session data from apc instead of hitting the database.

  3. #3
    Join Date
    Mar 2005
    Location
    Athens, Greece
    Posts
    1,763
    I have not experience with APC, but (I think) it is safer to keep your sessions in the database. So, it depends on the app and the security level you wish to have.
    Managed.gr cloud hosting, paas, vps, dedicated, domain registration on global datacenters.

  4. #4
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    1,737
    What's "APC"? Is that different from the default PHP behaviour of keeping the sessions in flat files in /tmp?

  5. #5
    Join Date
    Mar 2005
    Location
    Athens, Greece
    Posts
    1,763
    APC stands for Alternative PHP Cache - it is cache framework.

    Find more at www.php.net/apc
    Managed.gr cloud hosting, paas, vps, dedicated, domain registration on global datacenters.

  6. #6
    Join Date
    Dec 2004
    Location
    New York City, NY, USA
    Posts
    735
    My understanding is that APC is a bytecode compiler and cache--which has absolutely NOTHING to do with sessions. APC effectively caches source code, not values, so unless you have self-modifying code I don't see what APC and session storage have to do with each other.

  7. #7
    Join Date
    Dec 2005
    Posts
    550
    It can be used as a general cache like memcache.

    see apc_fetch and apc_store.

  8. #8
    Join Date
    Dec 2004
    Location
    New York City, NY, USA
    Posts
    735
    Quote Originally Posted by grabmail
    see apc_fetch and apc_store.
    Hrm, neat new feature!

    AFAIK it still works differently than memcached... APC relies on POSIX shared memory, while memcached does not, which generally means APC will be slower than memcached.

    But none of this has to do with your original question--if you're saving to both the database and APC, it's probably no harm to get a performance boost of querying APC for reads. I'd say go for it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •