ID: 31332 Updated by: [EMAIL PROTECTED] Reported By: marekm at apnet dot pl -Status: Verified +Status: Feedback Bug Type: Performance problem Operating System: * PHP Version: 4CVS, 5CVS (2005-01-04) New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Please try this with the next snapshot that is build at 19:30 GMT. I made some changes to unserialize() that should have restored its speed. Previous Comments: ------------------------------------------------------------------------ [2005-01-14 22:47:03] chris at fast4gl dot com I'd agree, this is a huge performance issue in 4.3.10/5.0.3 which really needs to be fixed ASAP. I've seen many servers with performance issues because of this bug since upgrading PHP. ------------------------------------------------------------------------ [2005-01-14 18:17:55] dondop at gmail dot com It has been quite some time now and this is really an important bug to fix. I understand that open source means that development is done when someone feels like it, but as this is crumbling big shared hosting solutions where sites run on this PHP which use unserialize() I really a fix is developed soon. Comon devs, wake up and smell some coffee :) ------------------------------------------------------------------------ [2005-01-14 14:40:52] john at jelsoft dot com I would agree with what Gik just said. To quote from the PHP manual: "serialize -- Generates a storable representation of a value" Or later: "serialize() returns a string containing a byte-stream representation of value that can be stored anywhere. This is useful for storing or passing PHP values around without losing their type and structure." I tried some comparisons a while back on different ways to store PHP array data in a DB. I tried storing it in a form where I could run eval($data) and it turned out to be a lot slower than unserialize($data). (Perhaps this would be different given this bug). serialize() seems to be ideal for this situation where large array or object data is to be stored in a DB or shm. So I was surprised that the usages outlined above are 'abuses', as they seem to be using serialize() for exactly what it was intended for. Perhaps the manual needs clarifying if this isn't the case? ------------------------------------------------------------------------ [2005-01-14 13:52:06] gik at zap dot cl As far as I know, objects stored in shared memory using shm_put_var() are stored serialized. I haven't looked at the sources yet, but the problem affecting unserialize() should also degrade the performance of shm_put_var() which is vastly used to store arrays or other objects in shared memory for _quick_ access. I don't know if there are other functions which use this method internally. I wouldn't call it an abuse to serialize and store an array with 1000 elements in shm, as this is a very efficient way to do data caching. The performance degradation is large enough to make a web server collapse, because of the extra time required to process each request. ------------------------------------------------------------------------ [2005-01-14 09:05:51] [EMAIL PROTECTED] Sorry to say... but abusing serialize for this is not a good idea in the first place. It's not meant for storing data in this way in the first place. But of course the slowdown shouldn't have been this much. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31332 -- Edit this bug report at http://bugs.php.net/?id=31332&edit=1