php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37840 uniqid() without more_entropy extremely slow
Submitted: 2006-06-18 17:21 UTC Modified: 2006-11-21 01:00 UTC
Votes:4
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:3 (75.0%)
From: diego at caravana dot to Assigned:
Status: No Feedback Package: Performance problem
PHP Version: 5.1.4 OS: Linux 2.4.21
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-06-18 17:21 UTC] diego at caravana dot to
Description:
------------
See #37106 first.

Ok, this may be "bogus", but is there a workaround or some other unique id generator in PHP?
I've spent 2 days trying to figure out why my webapp was *so slow* on production server, when on develop/test environments it was acceptable... At last, I profiled (APD) it and discovered that uniqid() was terribly slow. I searched for some big problem in my app then, without any other clue, I commented out the usleep() call in uniqid.c: magically, a page that took 10 seconds now responded under 1 sec!
I tried with the following lines instead of usleep(), but with the same problem:

        struct timespec tsq;
        tsq.tv_sec = 0;
        tsq.tv_nsec = 1;
        nanosleep(&tsq, NULL);

FYI, I "patched" PHP 5.1.4, and the server with the problem runs an updated RHEL 3 (Linux 2.4.21-40.ELsmp).


Patches

Uniqid (last revision 2010-04-22 06:32 UTC by mwoolf at mcomi dot net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-13 22:41 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-11-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-08-09 13:03 UTC] franz dot sedlmaier at gmx dot net
I can confirm this issue for newest PHP version (5.2.3).
 [2010-11-13 10:18 UTC] Mikhail dot V dot Gavrilov at gmail dot com
Comfirm this issue. PHP 5.3.3 Linux and Windows
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC