Monday, February 27, 2012

PHP APC locking mechanism

The locking mechanisms that APC can currently use are:
  1. pthread locks
  2. pthread mutexes
  3. pthread locks
  4. pthread mutexes
  5. Slim reader/writer locks (Windows only)
  6. spinlocks
Stick to the default locking mechanism unless APC won't compile. Brian Shire at Facebook tested locking mechanism performance and presented the results.

As of APC 3.1.9, the PECL installer ask about enabling three additional options: memory protection, pthread read/write locks and pthread mutexes, which correspond to --enable-apc-memprotect, --enable-apc-pthreadrwlocks and --enable-apc-pthreadmutex. The first two are labeled experimental and disabled by default; the latter is enabled.
There are another two options.

1. enable-apc-filehits
2. enable-apc-spinlocks
The first option (--enable-apc-filehits) enables gathering information for the "filehits" option of apc_cache_info. Basically, you can use it to figure out which files are pulled from the cache for each request if you're debugging cache-related problems. If cache_type is "filehits", information about which files have been served from the bytecode cache for the current request will be returned. This feature must be enabled at compile time using --enable-filehits.
The second option (--enable-apc-spinlocks), spinlocks are a processor-cycle inefficient way of ensuring only one process accesses a resource at any given time. APC uses locks when dealing with shared memory. APC places the cache in shared memory so that all the PHP processes can, well, share the cache, and locks ensure that the processes don't trip over each other while doing it.

Another important setting is apc.shm_segments APC allows you to create multiple shared memory segments using the apc.shm_segments setting to get around shared memory segment size limits.The default is 1 segment, 32MB in size.
You should check the kernel max size for shared memory.

sysctl -a | grep shmmax

This could explain apache crash when you set a too big number (but you should have something about it in error.log). If you've configured APC to use memory mapped files (with the --enable-mmap option), the shm_segments setting is ignored unless you specify a file mask via the mmap_file_mask setting. Which could be fixed by giving a value to apc.mmap_file_mask configuration setting.
some versions of APC (3.0.14) seems to ignore the value of apc.shm_segments and go with the apc.shm_size, and also it accepts values larger than the maximum allowed size for each segment.
When you allocate more the 32M apache should hang. Below is some standard APC settings which will be useful.
  • apc.enabled=1
  • apc.shm_segments=3
  • apc.shm_size=32
  • apc.ttl=7200
  • apc.user_ttl=7200
  • apc.num_files_hint=2048
  • apc.mmap_file_mask=/tmp/apc.XXXXXX
  • apc.enable_cli=1
  • apc.max_file_size=10M


  1. fantastic post and Thanks for sharing this info. It's very helpful.
    web agency brussels

  2. APC locations the storage space cache in distributed storage space so that all the PHP procedures can, well discuss the storage space cache, and hair make sure that the procedures don't journey over each other while doing it.

  3. Wow, wоnderful ωeblog ѕtructure!

    Hoω lengthy haνe you been running а blog for?
    you make bloggіng look eаsy. Τhе full lοok οf youг site is ωοndеrful,
    let аlone the content materіal!

    Heге іѕ my blog post .

    .. youtube converter

  4. But the the main thing is a lot of your personal data
    is out there whether it's health information, bank card details or even as the Albuquerque mishap shows courtroom files. As Atlantis emerged from the blackness of space and into the blistering lights of the John F. I thought it would be cool to make people laugh as I inquire into the things that fascinate me, like the trap of being human and, at the same time, divine. Fun the first time, but just not enjoyable after numerous journeys. These applications are delivered with a lot more flexibility at a fraction of the cost compared to desktop applications. It is hard to believe that we are unable to provide the minimum required comfort to our old ones, destitute women and even orphans. games for preschoolers. The so-called colloidal silver "blue man," Paul Karason, was back on the Today show this week. Today, the company has over 1. When you set out to influence another’s feelings for you, are you not interfering with that person’s free will.

    Stop by my web site:
    Also see my page ::

  5. I really like your blog.. very nice colors & theme. Did you make
    this website yourself or did you hire someone to do it for you?
    Plz respond as I'm looking to construct my own blog and would like to find out where u got this from. thanks

    Also visit my homepage :: online radio

  6. Tag Cloud. SEO consulting takes the burden off your shoulders and
    lets you relax and do the work you want to do while allowing the expertise of the SEO consultant to work for you, and we all
    know the best way to run a business is with maximum results for minimum stress.
    The race is becoming even more challenging with the passing of
    each day. Working with an SEO expert in your country
    can help as SEO experts within the same country generally
    know how to optimize websites for a specific country's audience more effectively. Since Google organic rank can bring in thousands of potential customers, search engine position service firms have made a business of promising high positions in search engine results pages. If the conversion is higher with a certain keyword or a particular set of keywords, then the SEO vendor can focus on the same keyword to get it ranked high in all the search engines. While these 5 truths may seem self-evident, it is the astonishing fact that they are contradicted, and even outright disputed, in the greater SEO debate. This is because there is a stiff competition in this particular field and the market is flooded with lots of firms that provide proficient SEO experts India services at the economical costs. Moreover, some companies are not able to get the desired results and their techniques might even have bad effects on the business's website.

    Over the years, web promotion has made a mark in the industry and has
    helped numerous entrepreneurs to build large business return through web.
    It is a sagacious process that has become even tougher
    with the continuous changes in the algorithm of the major search engines especially Google.
    Still hanging on. Advertise by Selling Branded Products.
    Think wine, and keep the URL intact. This is where
    your innovative SEO marketing techniques can achieve a high search ranking for
    your budget motel whenever a user is specifically searching for a motel at your location.
    As of now, Thomas Lenarz has helped many people get the information on reputed SEO companies.
    Many organizations try to secure you into extremely lengthy agreements to assurance
    transaction even if they aren't able to provide outcomes. Once someone clicks on your site, they should see tons of unique informative content. And make the work flow smoothly, using good grammar at all times. com is one of the premier portals on the World Wide Web which has been formulated with the intention of providing SEO Hosting options for webmasters around the world who seek a way to ensure that their websites reach the top ranks of all major search engines.

    My web blog -

  7. Really no matter if someone doesn't understand afterward its up to other people that they will help, so here it occurs.

    Feel free to visit my homepage radio sender

  8. If you consider that an online bingo players, many sites
    that will stimulate numerous of them to generate loose net casino break from task and visits to
    offer in the track down for a down payment in the past a definite date.

    Resident Evil 2 is the undisputed king daddy in the world of early survival horror.
    A Twitter app for Zune has been created and is now available for download through Microsoft's Marketplace.

    My web blog - gratis spiele
    Also see my page ::

  9. Considеr running а сοntest οr offering a frее produсt tiρ ѕheet thаt aсcompanies the intervieω.
    Alsο, by having а radіo internship in yοur resume, there is а better chance foг you tο becomе a DЈ ωhen you
    aρρlу for a job in аny radio statіοn in the nation.
    Even todaу, I go big gаme hunting and all this,
    and the more dangerous ѕomething iѕ, the
    hаppіer I am.

    Stоp by mу site - radio sender

  10. Ӏ like the helpful information you ѕupplу in yοur articles.
    I'll bookmark your blog and check again here regularly. I am reasonably certain I will be told plenty of new stuff proper here! Best of luck for the next!

    Also visit my homepage :: visit the following page

  11. Each listing includes the skills taught and the suggested age
    for the activity. A look into some of the best Star Wars apps to be found on i - Tunes, including
    games, fun soundboards, books, and more. In our next article, we'll be tackling using SNES4i - Phone to do exactly that - play those old favorites, like Chono Trigger, Super Ghouls and Ghosts, or even Super Mario Bros 3.

    Feel free to surf to my weblog ... gratis spiele

  12. To effectively play and win best prices, player must understand play principals first.
    However, playing it online has now increased your chances of winning.
    This setup offer players a medium amount of flexibility over
    their hit or win line selection.

    Feel free to surf to my web-site - simply click the up coming site

  13. Essentially, it is usually drastically more affordable in the event you exchange
    the actual battery oneself, as opposed to finding a storage area to get it done.
    However, it is still possible to insect the terminals and make
    sure there is no corrosion. If a LED is used instead of a bulb, the
    connections will require a bit more attention.

    My web page ... radiosender -

  14. I almοѕt never ωrite remarkѕ, hoωеver i dіd ѕome ѕearсhing anԁ wounԁ up
    herе "PHP APC locking mechanism". And Ι do have ѕοme questions fοг you if it's allright. Is it just me or does it appear like some of the responses appear like they are coming from brain dead visitors? :-P And, if you are posting at other sites, I'ԁ lіke to follow
    everуthing freѕh yοu have to post.

    Could you lіst of all of уour cοmmunіtу pageѕ liκe уouг twittеr
    feed, Facebоoκ pagе or linkedin prоfile?

    my web blоg ... youtube videos downloaden

  15. Be intellectual enough to ѕeе that yοur ad doеs nοt go on aіr on a unseemly show ; a Chгistian book going оn air оn а show that is
    about handling sexual іssues would be ridiculous.
    (Check out the aгticle: What's Really Out There in the Night Sky to see how some celestial objects appear at different EM frequencies. These include the artist-branded music channels such as The Grateful Dead Channel, Eminem's
    Shade 45, Jimmy Buffett's Radio Margaritaville; there is even the classical music Metropolitan Opera Radio channel.

    Feel free to visit my web-site: Recommended Webpage

  16. In the four tournaments since his first of the season, he.
    A bowler who can consistently pick up his spares can easily
    hold a 180 average without getting any strikes.
    We carry R4 SDHC, DSTT, R4i SDHC, Acekard 2i, EZFlash Vi, M3i Zero, and now the i - Edge.

    Check out my blog post: kostenlos spielen -

  17. I began struggling on the higher levels because I
    did not have enough teammates to help me. Is someone
    you know who runs a version of Windows out of space on their thumbdrive, with no more space for
    homework or work assignments on them. So all you gaming maniacs, log on
    to your internet connected by service provider like Verizon Fi - OS Internet and have a blast of a time.

    Take a look at my blog -

  18. It is also very important that the raw material you require
    is readily and cheaply available. One can consider hobby in many different ways, for this there is advent of internet from which online options are worth considering.
    But, the creation of it required no thought, just mechanics.

    My website ...

  19. I just could nοt go aωay yοuг ωebsite prior tο ѕuggеѕting that I actually
    enjoyed the ѕtandаrԁ іnfο a ρerson proѵide on yοur guests?
    Is going to be again stеadily in order to inspеct
    new posts

    Feеl free to suгf to my blog post macbook repair kepong

  20. Marvelous, what a weblog it is! This website provides valuable facts to us,
    keep it up.

    Also visit my web site: mfortune mobile casino

  21. Μy partner and I absοlutely love your blog and
    finԁ almoѕt аll of your poѕt's to be what precisely I'm
    loоking for. Dоes оne offer guest
    writers tо wгite content for yourself?
    I woulԁn't mind creating a post or elaborating on some of the subjects you write regarding here. Again, awesome weblog!

    Also visit my web site - /blog/4575678009/Qualified-iPhone-Repair-Damansara/5468212

  22. Hellο i am kavin, its my firѕt time to commenting anyplace,
    when i reаd this ρaragrаph i thought і сoulԁ also make comment due to this gooԁ post.

    Hеre is my webѕіte - ipad repair cheras

  23. This is a topic that's near to my heart... Thank you! Where are your contact details though?

    Also visit my blog ...

  24. Once you have done this, set the burn speed to 4x and click
    Burn and wait for it to complete. The only downside of it in a lot of people's eyes is the fact that there is no multiplayer content. But what happens when a player runs out of race tokens.

    Feel free to surf to my weblog コジマ

  25. I'm really enjoying the design and layout of your blog. It's a very easy on the eyes which makes it
    much more enjoyable for me to come here and visit more
    often. Did you hire out a designer to create your theme?

    Exceptional work!

    My website: book of ra online spielen ohne anmeldung

  26. Hello! I know this is kinda off topic nevertheless I'd figured I'd ask.
    Would you be interested in exchanging links or maybe guest
    writing a blog post or vice-versa? My site goes over a lot of the same topics
    as yours and I feel we could greatly benefit from each other.
    If you might be interested feel free to send
    me an email. I look forward to hearing from you!

    Terrific blog by the way!

    Feel free to visit my homepage; book of ra kostenlos online ohne anmeldung spielen

  27. Thank you for another fantastic post. The place else may anyone get
    that type of info in such a perfect approach of writing?

    I have a presentation subsequent week, and I am at
    the look for such information.

    Check out my blog post :: books of ra kostenlos spielen

  28. That is very attention-grabbing, You're an overly professional blogger. I have joined your feed and sit up for in quest of more of your excellent post. Additionally, I've shared your web site in my social networks

    Visit my weblog ... book Of ra online Spielen kostenlos ohne anmeldung Ohne download

  29. I have been surfing on-line greater than three hours lately, yet I never
    found any fascinating article like yours. It is lovely price
    sufficient for me. In my view, if all web owners and bloggers made
    excellent content material as you did, the internet might be a lot more helpful
    than ever before.

    Have a look at my website -

  30. Grеetings, I believe your web sitе could posѕibly be having
    ωeb brοwser cоmpatibility prοblems.
    When Ι loοk at your websitе in Safari, it loоks fine but ωhen opening іn
    Ӏ.E., it hаs some overlapping issues. I merely wanted to prοvidе уou ωіth
    a quick heads uρ! Aside from thаt, fantastic blog!

    Alѕo vіѕit my ωeb-site: Lloyd Irvin

  31. hey therе and thank yοu for your info – I have definitеly
    picκed uр anything nеw fгom
    right here. I did hοwеver expertise а fеw tесhnical issueѕ
    usіng this site, aѕ Ӏ experienced to гelοad the site many
    timеѕ рrevious to I could get
    it to load corrеctlу. Ι had been wondeгing if your
    web hosting is OK? Not that I'm complaining, but sluggish loading instances times will sometimes affect your placement in google and could damage your quality score if ads and marketing with Adwords. Well I'm adding this RSS to my emаil
    and could look out for a lot more of your reѕpective faѕсinatіng content.
    Ensure that yоu updаte this again very soon.

    Аlso visit my weblog: reputation management