Optimizing php, xcache

Discussion in 'PHP' started by kuszeras, Feb 8, 2012.

  1. #1
    Has anyone ever tried to optimize (and how) their php code with success?

    How do You profile Your scripts?

    Has anyone used optimization with a compiled code cache (xCache) and that helped?

    Cheers!
     
    kuszeras, Feb 8, 2012 IP
  2. awood969

    awood969 Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    40
    #2
    Using XCache or APC they are simply PHP modules so you must compile PHP with them and they will automagically cache bytecode for future use. These scripts work lovely for things like blogs or sites where content is dynamically loaded but rarely changes once set.

    Other profiled cache systems like memcached requires a lot of set-up and config however they can convert the code to binary and store in memory, this makes the code amazingly fast. From here it will leave variable gaps so that even the most dynamic pages will still load very fast.

    Thanks
    Andrew
     
    awood969, Feb 9, 2012 IP
  3. kuszeras

    kuszeras Active Member

    Messages:
    326
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    #3
    Ok, but still if content should change does it notice that and clears the cache immediately? How is that possible?
     
    kuszeras, Feb 9, 2012 IP
  4. awood969

    awood969 Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    40
    #4
    If your using a PHP Module then it will automatically detect any changes and recache, so no effort on your part. If you are using a memcached server then you need to program memcached script in anyway so it will be done through this.

    Basically unless you are planning to launch the next Facebook or Google I wouldn't worry about using anything more than APC or XCache (APC is much easier to compile into PHP). I wouldn't even bother installing one of these unless you actually need it, which you won't unless the site is receiving lots of visitors every second. If a cache server isn't being used then its just wasting memory and cpu through overheards on the server.

    Thanks
    Andrew
     
    awood969, Feb 9, 2012 IP
  5. shraddha_v

    shraddha_v Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi Andrew,
    I want to implement Xcache in my application. I have installed the thing in my wamp server. But I don't get how exactly to use the various functions. Can You please help me with some code examples. Basically i am going to use XCache to generate the reports i.e., for e.g., admins report to see the various user details like usernames and passwords, etc.

    Thanks.
    Shraddha.
     
    shraddha_v, Mar 26, 2012 IP