apc

Does adding Memcached/APC require writing codes again?

家住魔仙堡 提交于 2019-12-23 05:52:08
问题 I'm planing to add APC or MEMCACHED to my PHP code ! my question is does it require to rewrite all the code ? as i looked in to PHP Manual and there i got this ! function get_foo(foo_id) foo = memcached_get("foo:" . foo_id) return foo if defined foo foo = fetch_foo_from_database(foo_id) memcached_set("foo:" . foo_id, foo) return foo end So, for storing the variable i need to do memcached_set(...) or it's like that i add the plugin and get the performance boost ! I have no idea on APC /

Does adding Memcached/APC require writing codes again?

心不动则不痛 提交于 2019-12-23 05:52:07
问题 I'm planing to add APC or MEMCACHED to my PHP code ! my question is does it require to rewrite all the code ? as i looked in to PHP Manual and there i got this ! function get_foo(foo_id) foo = memcached_get("foo:" . foo_id) return foo if defined foo foo = fetch_foo_from_database(foo_id) memcached_set("foo:" . foo_id, foo) return foo end So, for storing the variable i need to do memcached_set(...) or it's like that i add the plugin and get the performance boost ! I have no idea on APC /

Log visits in shared memory

青春壹個敷衍的年華 提交于 2019-12-22 10:59:40
问题 I'm trying to find best way to log visits using PHP. Right now I have about 3000 request per second and I write each visit to CSV file. I was wondering is it faster to log each visit in memory somehow and then dump it to CSV file after 100 000 records? I've checked shmop apc and memcache so far but can't find proper solution. 回答1: The best way is to use Lua with shared memory to store log entries, then create a timer which checks the size of logged entries every X seconds and uses a co-socket

How to clear APC cache without crashing Apache?

放肆的年华 提交于 2019-12-22 10:55:09
问题 If APC stores a lot of entries, clearing them crashes httpd. If apc_clear_cache('user') takes longer than phps max_execution_time the script calling apc_clear_cache will be terminated by php before the clearing-operation is finished. this seems to leave some handles or sth. that will prevent apache from closing it's processes. (http://pecl.php.net/bugs/bug.php?id=13445) Is there some other quick but safe way of bulk cleanup of APC cache? 回答1: You can remove the time limit on a script you're

APC doesn't cache files, but caches user data

点点圈 提交于 2019-12-22 06:37:39
问题 Apc doesn't cache files, it only caches user data . When I tested on localhost, APC cached all files I used. But it doesn't work on my shared hosting. Is this a configuration issue? These are the stats from my apc.php (APC 3.0.19): On the above picture, APC doesn't use any memory. This is what phpinfo() gives me: On localhost, i only access http://localhost/test.php. Apc will cache localhost/test.php ( type file ) imediately. but on shared host, i don't see it cache file ( it can cache

APC is showing 100% fragmentation

Deadly 提交于 2019-12-21 07:05:41
问题 APC is showing 100% fragmentation. Is this bad? Does it mean that it's not helping at all? What paths do I go down to improve situation? Thanks in advance. 回答1: In my experience, yes. I had a system where APC was showing 100% fragmentation, and performance was bad. I increased APC's memory limit (to 200 MB in my case -- but we had a lot of code) enough to give it some slack room. Fragmentation dropped to zero, and IIRC, CPU usage on the server dropped by 50%. Also, make sure you're using the

Will killed process/thread release mutex?

坚强是说给别人听的谎言 提交于 2019-12-21 03:55:15
问题 Several processes access shared memory, locking it with the mutex and pthread_mutex_lock() for synchronization, and each process can be killed at any moment (in fact I described php-fpm with APC extension, but it doesn't matter). Will the mutex be unlocked automatically, if the process locked the mutex and then was killed? Or is there a way to unlock it automatically? Edit: As it turns out, dying processes and threads have similar behavior in this situation, which depends on robust attribute

Where does APC store its opcode and user variable cache?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 20:00:34
问题 The reason I ask is because when using top I don't see a process for anything like APC. So I assume that the memory usage would be accounted for in an apache process. Is that the case, and does that mean that the memory APC is using is replicated in each apache process, thereby taking up potentially much more memory than what was originally assigned to it? If this is the case would memcache be a better solution, even if it's not being used on multiple loadbalanced servers? 回答1: APC uses

Anyone successfully serving high traffic with PHP 5.4.4 and APC 3.1.10? [closed]

前提是你 提交于 2019-12-20 16:24:53
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Call to undefined method after upgrading to PHP 5.4.0 mentions a few APC bug-reports from March 2012. My concrete question is: Is PHP

PHP APC in CLI mode

China☆狼群 提交于 2019-12-20 09:53:28
问题 Does APC module in PHP when running in CLI mode support code optimization? For example, when I run a file with php -f <file> will the file be optimized with APC before executing or not? Presuming APC is set to load in config file. Also, will the scripts included with require_once be also optimized? I know optimization works fine when running in fastcgi mode, but I'm wondering if it also works in CLI. apc_* functions work, but I'm wondering about the code optimization, which is the main thing