[PHP-DEV] PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-14 Thread Israel Ekpo
Hi All,

I have a few questions about the performance of PHP web applications *under
load* and I would appreciate if there is anyone that would like to share
their experiences in terms of any benchmarks or observations.

*Background Information*

In multi-process environments, such as FastCGI, Apache Prefork MPM etc, PHP
needs to execute the MINIT and MSHUTDOWN functions for all loaded extensions
on every request.

In a multi-threaded environment, such as Apache Worker MPM, with Zend Thread
Safety is enabled,
PHP only needs to execute MINIT and MSHUTDOWN functions once for each
extension and not each time a new thread is created to serve a request.

It is also more expensive to create new processes than to create new
threads.

In one-on-one comparisons between scripts executed only once in ZTS mode and
scripts executed once in non-ZTS mode,
I noticed that the one in non-ZTS mode was slightly faster and this seems to
be the main reason why most people go with the non-ZTS enabled setups.
But the reason for this slight difference in speed is because of the
differences in the data structure for globals for ZTS and non-ZTS modes.

Other reasons people have cited for going with non-threaded setups include
stability which I guess we should not really be concerned about if
non-threadsafe extensions are excluded.

Since it is generally more expensive to create new processes than new
threads, I believe that under high load, php in ZTS mode (multi-threaded
environment) will perform better than an identical setup in NTS mode
(multi-process).

*Problem*

I noticed that Zend Server is using PHP in FastCGI mode (multi-process NTS)
and I am contemplating setting up apache in worker mode (threaded mode) and
compiling php in ZTS mode instead.

Has anyone performed any load tests benchmarks comparing the two setups
(Multi-Process vs Multi-Threaded)?

Are there PHP extensions that cause issues in threaded environments that I
should avoid?

Are there any internals information or any other reasons why I should choose
ZTS over NTS or vice versa?

Any useful feedback will be highly appreciated.

Thanks.

-- 
°O°
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.
http://www.israelekpo.com/


[PHP-DEV] Re: [INTERNALS-WIN] Assistance Needed with config.w32 and .dsp scripts

2009-11-22 Thread Israel Ekpo
Pierre and Pierrick,

Thanks a lot once again for helping me out!

I really really appreciate it. You have really helped out a lot of the
windows PHP user space developers that could not use the extension.

I also  thank Kalle and Felipe for their contributions in reviewing the
initial releases of the SOLR module for bugs and compatibility with C++ and
Windows compilers. I am now able to compile it without any warnings.

I will add your 4 names to the next release of the SOLR extension as the
people that made the release happen.

This has also paved way for the 1.0 release which I intentionally postponed
until it was available for the windows platform.

Once again thank you very much.

You guys rock!

On Sun, Nov 22, 2009 at 7:11 AM, Pierre Joye pierre@gmail.com wrote:

 hi,

 On Tue, Nov 17, 2009 at 10:26 PM, Israel Ekpo israele...@gmail.com
 wrote:
  Hi Everyone,
 
  My name is Israel Ekpo
 
  I am trying to compile the Solr extension on Windows XP using Visual
 Studio
  2008 but I am getting compile errors.

 Current trunk should work fine as long as you have libxml, curl, iconv
 and zlibs deps installed. I also uploaded 5.3 vc9-x86 ts and nts
 version of solr here: http://downloads.php.net/pierre/

 Cheers,
 --
 Pierre

 http://blog.thepimp.net | http://www.libgd.org




-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.


Re: [PHP-DEV] Why is ereg being deprecated?

2009-10-12 Thread Israel Ekpo
On Mon, Oct 12, 2009 at 1:28 PM, Derick Rethans der...@php.net wrote:

 On Mon, 12 Oct 2009, Mark Krenz wrote:

Again, this isn't a debate on which is better, I only want to STRONGLY
  stress that I think its a big mistake to remove it in 6.0.

 The ereg library doesn't handle unicode so it can simply not work.

  If nobody simply wants to do the work to make sure ereg is ready for PHP
  6 and unicode support, then you are not doing your job.  I hate to call
  it a job because I'm sure that you all enjoy doing PHP development, but
  there are times when you have to bite the bullet and do the hard work
  because its your responsibility to do so.

 Patches welcome.

 Derick

 --
 http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org
 twitter: @derickr

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php



PHP is the most popular web-development language and it would continue to
remain in that position for a very long time.

I don't think that if ereg is not longer bundled with PHP this will have any
effect in the number of PHP users.

There exists a very large number of PHP users around the world; however,
there is a significantly smaller and more miniscual number of people who
actually design and maintain PHP and its extensions.

It is important to stress that the PHP language is maintained by VOLUNTEERS
who are committed and dedicated to seeing that PHP continues to prosper
while maintaining high quality.

Change is something that most people struggle with.

As Pierre Joye suggested, just because there are lot of people driving
clunkers does not mean we have to keep using clunkers.

If there exist a faster, better and more efficient alternative, please
adapt.

Respect is reciprocal; please be nice to these volunteers because not only
are you not paying them but no one else is either.

Removing ereg from PHP might seem Cold Turkey but at this time that is the
wiser thing to do.

It's time for the clunker to go.

-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.


Re: [PHP-DEV] Why is ereg being deprecated?

2009-10-12 Thread Israel Ekpo
On Mon, Oct 12, 2009 at 3:14 PM, Mark Krenz m...@suso.org wrote:

 On Mon, Oct 12, 2009 at 05:55:25PM GMT, Carl P. Corliss [rabb...@gmail.com]
 said the following:
 
  Code Search of: eregi?(_replace)?\( lang:php shows ~123,000 results
  Code Search of:
 
 preg_(filter|grep|last_error|match_all|match|quote|replace_callback|replace|split)\(
  lang:php shows ~374,000 results
 
  Looks like preg_* functions are used more often than ereg* functions to
  me...

   I think everyone should read this as it will prove my point.
 Especially book #9

  I have a O'Reilly Safari Books Online account and can search the
 content of many of the latest books, which I consider something more
 official than just doing a causual Google search, which can be
 misleading.

  The number 1 selling book on Amazon in the PHP category is PHP and
 MySQL Web Development (4th Edition) from 2008 by Luke Welling and
 Laura Thomson.

  There is no mention of preg_match and the book instead shows how to
 use ereg based functions.  In fact, they do mention PCRE, but downplay
 it by saying that POSIX regexs are easier to use.


  I think any intelligent person would see this as a alarm that the PHP
 world isn't ready for ereg to be dropped or changed.  You need far more
 time for the information to make its way through the PHP community.


 Going further through the list of Amazon's top selling PHP books we
 have:

 2. The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP
 (Essentials)

  Ignore this as it isn't really covering PHP properly.

 3. Regular Expression Pocket Reference: Regular Expressions: from 2008

  This states that it covered PCRE expressions for PHP. So at least
  that's right.


 4. Learning PHP, MySQL, and JavaScript: A Step-by-Step Guide to Creating
 Dynamic Websites from 2009

  Uses examples written with preg_match

 5. Web Database Applications with PHP and MySQL, 2nd Edition from 2004.

  Mentions PCRE but says that they will use POSIX expressions instead.

 6. Head First PHP  MySQL from 2008/2009

  Talks about preg_match, mentions that ereg is removed in PHP 6.

 7. PHP Cookbook from 2006

  Has mixed examples, some using ereg and some using preg_match

 8. Practical WebPractical Web 2.0 Applications with PHP

  Not on Safari

   9. Programming PHP by  Kevin Tatroe, Rasmus Lerdorf and Peter
 MacIntyre in 2006. Which may be considered the definitive guide to PHP
 since Rasmus is a co-author.

  Uses examples with both ereg and preg_match, BUT ereg is used first in
 the book and compromises the majority of the section called Regular
 Expressions.  So here is an example of emphasis being placed on ereg
 being the more official functions to use.

 10. Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems

  Not on Safari

 So that's about 4 out of 7 the top selling books on PHP still strongly
 use ereg.  I didn't find any mention in the books I read online about
 ereg going away.  Some of them supported PCRE more than others. But
 obviously there is still a lot of use of the POSIX functions.

 These are best selling books on PHP.  So there ARE A LOT of programmers
 out there that think that they are doing the right thing using ereg.
 Obviously books can't be the authoritative source for functions, but a
 lot of times they are used that way, especially when one of them was
 written by the author of the language.  Duh!


  So there is my proof. Does anyone still want to dispute me that ereg is
 still heavily used and you'll make a lot of users angry if you don't
 give them the proper amount of time to make this transition?




 --
 Mark S. Krenz
 IT Director
 Suso Technology Services, Inc.
 http://suso.org/

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php


If you are feeling this strongly about ereg, I would suggest you do one of
the following:

1. Create a patch that contains a re-write and submit it for discussion to
the internals mailing list.

2. If you are unable to do # 1. Hire or get a volunteer who can and is
willing to create the patch for you.

This will save us a lot of time and energy that is being dissipated/wasted
in this discussion.

You can also document the issue in the wiki to warn userspace PHP developers
about the current situation.

Again, please note that PHP is designed, developed and maintained by
VOLUNTEERS.

Please treat these volunteers with respect.

-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.


[PHP-DEV] Bug #49325 Error in domdocument-schemaValidate

2009-10-05 Thread Israel Ekpo
This was actually not a bug with the PHP code.

The error was in the instance XML document.

I just closed the bug.

The contents of the element node did not conform to what is specified in
the XSD. After adjusting the contents of the instance XML document to
conform to the specifications of the XSD document, it worked as expected.

The original file is here :

http://israelekpo.com/php_bugs/NFe/43090803116611000198550011070
127.xml

The corrected version is here :

http://israelekpo.com/php_bugs/NFe/43090803116611000198550011070
127.correct.xml

PHP Code to verify success :

http://israelekpo.com/php_bugs/NFe/bug_49325.phps

?php

$xml = new DomDocument();
$xml-load('43090803116611000198550011070127.correct.xml');

$tempDom = new DOMDocument();

$tempDom-loadXML(utf8_encode($xml-saveXML()));

if ($tempDom-schemaValidate('nfe_v1.10.xsd'))
{
echo ok;

} else {

echo erro;
}

?

Expected result:

ok

Actual result:
--
ok


-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.


Re: [PHP-DEV] Bug #49325 Error in domdocument-schemaValidate

2009-10-05 Thread Israel Ekpo
On Mon, Oct 5, 2009 at 12:52 PM, David Zülke
david.zue...@bitextender.comwrote:

 On 05.10.2009, at 18:11, Israel Ekpo wrote:

  This was actually not a bug with the PHP code.

 The error was in the instance XML document.

 I just closed the bug.


 That should probably be closed as bogus, not closed.

 - David


Thanks David.

It will do that.

-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.


Re: [PHP-DEV] Doc on the VM

2009-10-02 Thread Israel Ekpo
On Fri, Oct 2, 2009 at 10:46 AM, Nicolai Scheer sc...@planetavent.dewrote:

 Hi!

 Mathieu Suen schrieb:
  Hi,
 
  I would like to know if there is some documentation on the different
  layout of the array, object varaible ... in php.
  Or were in the source can we read how the php VM reprensent those
 entites?

 At first, you should have a look at Zend/zend.h in the php source tree.
 There you'll find the definition of a php variable, the zval struct:

 struct _zval_struct {
/* Variable information */
zvalue_value value; /* value */
zend_uint refcount__gc;
zend_uchar type;/* active type */
zend_uchar is_ref__gc;
 };

 The content of the variable is:

 typedef union _zvalue_value {
long lval;  /* long value */
double dval;/* double value */
struct {
char *val;
int len;
} str;
HashTable *ht;  /* hash table value */
zend_object_value obj;
 } zvalue_value;

 Since a php variable can contain any type php has to offer, this
 representation was choosen in order to simplify access on the internal
 side.

 There's a bunch of macros for creating zvals, getting/setting
 types/values, etc. so you don't need to do this by hand (of course, in
 complex cases you have to).

 Does this help?

 greetings,

 Nico


 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php



Hello,

As Mathieu advised, taking a look at some of the source code would be very
helpful

You should also take a look at these files in the Zend folder of the PHP
source:

zend_object_handlers.c
zend_object_handlers.h
zend_objects.c
zend_objects.h
zend_objects_API.c
zend_objects_API.h

After that, I would advice that you grab a copy of Sara Golemon's book. It
was really helpful to me as well.

*http://www.amazon.com/Extending-Embedding-PHP-Sara-Golemon/dp/067232704X*

One similarity between arrays and objects is that they both use the
HashTable type to store their elements (for arrays) and properties (for
objects).

For objects (classes), however the class has to be made available during the
MINIT phase whereas for arrays that is not needed.

There are other similarities and differences but Sara Goleman's book will
definitely give you a head start and then you can figure out the rest as you
practice.

There are also differences between PHP 5.2 and 5.3, they use fifferent
versions of the Zend Engine (2.2 and 2.3 respectively) some members of the
zval struct have changed and you will need to use the macros to access some
of the members of these structs for compatibility reasons.

-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.


Re: [PHP-DEV] Buildbot setup / do you want access to testing platform?

2009-09-30 Thread Israel Ekpo
On Mon, Sep 28, 2009 at 1:55 PM, Hannes Magnusson 
hannes.magnus...@gmail.com wrote:

 First off, don't top-post :)

 On Sun, Sep 27, 2009 at 05:12, Israel Ekpo israele...@gmail.com wrote:
  Hi Hannes,
 
  I want to help out.
 
  What do I have to do to set it up and what will be my responsibilities
 after
  that.

 Your job would be to figure out the best way to do compile-testing on
 bunch of platforms, and run our test suite on those platforms
 (buildbot was the favorite of your predecessor, who unfortunately
 doesn't have the time right now). After having figuring that out you'd
 need to get it up and running on the various platforms (probably
 coordinating with Zoe, who knows the status of the run-tests
 'framework' and could help you integrating the testing results in a
 readable manner).

 You would most definitely need to maintain the system for several
 years, so the better you are to help others understanding the system
 and sharing information the more chances you have of 'getting
 vacation' and piece  quite when you need it ;)

 So, are you up for the job soldier?

 -Hannes



Hi  Hannes,

Sorry for taking this long to respond.

1. I am ready for the challenge!

2. I would prefer to start with the Debian lenny server.

Most of my experience is with Ubuntu and CentOS.

Since Red Hat or CentOS is not one of the options, the Debian server will be
one that I am most comfortable with working with as it is the closest one to
Ubuntu.

3. After setting up the environment, I will attempt to replicate the set up
on the other servers listed here

http://wiki.php.net/internals/buildbot#operating_systems_available

FreeBSD 6.4 is available on 80.82.121.132
FreeBSD 7.2 is available on 80.82.121.133
Debian lenny is available on 80.82.121.134
OpenBSD 4.5 is available on 80.82.121.135
NetBSD 5.0 is available on 80.82.121.136

4. I am not really familiar with the buildbot process so I have some
questions .

By test suites and run-tests you are referring to the make test option
a developer has after compiling php, correct?

5. After setting up the environment successfully, I think the test results
should be formatted as XML for easy digest by humans and onward
transformation to other formats.

*How I plan to implement this :

1. I will set up a web service so that the a post commit hook from the
svn.php.net server can notify the build system immediately a commit is made
to the repository.

2. This notification will get dropped into a queue and the target revision
number will be checked out from SVN and compiled. Each revision number will
be compiled separately in sequence.

3. If the compilation fails, then the error messages will be captured. If it
passes, then the test suite will be applied.

4. The results will be captured and stored in the recommended format for
consumption later.

What do you think?*

-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.


[PHP-DEV] Re: [PECL-DEV] SVN Account Request: iekpo

2009-09-21 Thread Israel Ekpo
Hey guys,

Please don't forget my PECL and SVN account request.

I am still waiting.

On Mon, Sep 21, 2009 at 10:59 AM, Israel Ekpo israele...@gmail.com wrote:

 I have a php extension for Apache Solr that I would like to publish and
 introduce to the PHP community.

 Hannes Magnusson sent me here to this page to request an SVN account.

 I will need access to php-src/ext/solr and also phpdoc to create
 documentation for the extension.

 So, I would be very grateful if someone could grant me a PECL account (with
 username iekpo) with access to SVN and karma so that I can also add
 documentation to the manual.

 The Solr extension is a fast, light-weight, feature-rich library that
 allows userspace PHP developers to communicate effectively with Solr server
 instances.

 There is already built-in support for Apache Solr 1.4

 There are a set of tools to add documents and make updates to the solr
 server.

 It also contains tools that allows you to build advanced queries to the
 server when searching for documents.

 There are also special objects that simplifies the sending of name-value
 requests to the server for searchs etc.

 This is the SolrParams class and all its child classes.

 I have created some userspace documentation here. The c space documentation
 is in the source code it self.

 http://www.israelekpo.com/solr/doc/

 The extension itself is located here

 http://www.israelekpo.com/solr/php-solr.tar.gz

 There are some simple examples on how to add documents to the Solr index
 and query for them too.

 Please check it out and let me know what you think.

 Thanks.

 --
 PECL development discussion Mailing List (http://pecl.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.