[fw-general] stored procedure error after upgrade to 1.8

2009-06-04 Thread Matthew Hoopes
Hey guys,

Since upgrading my Zend Framework from 1.7 to 1.8, I've started getting an
error when trying to execute a stored procedure.

My PHP install is on Ubuntu,
PHP 5.2.4-2ubuntu5.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 11 2009
20:09:52)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans


And I've seen the bug: http://bugs.php.net/bug.php?id=42548

However, when I switch back to 1.7 from 1.8, I get the desired results.

$ret = $db-query(CALL my_proc(?), $id);
$data = $ret-fetch();  // get the row from the result set
$ret-closeCursor();// clean up after ourselves so we don't get a
mysqli error

In this code, $db is a Zend_Db_Adapter_Mysqli, from which all other queries
work. The error I'm receiving is:

Mysqli statement execute error : PROCEDURE my_proc can't return a result set
in the given context

Is there anything I should do with the mysqli object to avoid this? Can I
set some server options with mysql option multi statements?

Thanks,
- matt hoopes


Re: [fw-general] XMLRPC Server Performance

2008-10-17 Thread Matt Hoopes
 One of the issues with the various server components is that they all
 rely on reflection. One idea I've had is to refactor them to allow
 caching all the metadata needed to store method signatures and map them
 to class methods so that after the initial request, reflection is not
 necessary. I'm still scoping the work necessary to do so, however, and
 it may or may not make it into the 1.7.0 release.


Matthew,
Thanks for the response. I guess I was confused about why three simultaneous
requests would slow down the response time so much. I would think that
they'd each be served in a different apache process (The PID of the process
in those log lines is in the brackets after the timestamp), and as such,
shouldn't really affect each other. Should they? Or is it simply a CPU
capacity / disk IO problem? If all requests took as much time as the single
request alone, I think it would be good to go. Is this more of an apache
tuning issue?

thanks for an advice,
- hoopes


[fw-general] XMLRPC Server Performance

2008-10-16 Thread Matt Hoopes
Hey guys,
I'm planning to use Zend_Xmlrpc_Server for my API. I have it working, and so
far, it's been super. It's made everything incredibly easy to do. My only
issue so far has been performance, and a weird quirk that I've found through
a bit of testing. Based on a previous issue (
http://framework.zend.com/issues/browse/ZF-3280), I'm not using
Zend_XmlRpc_Server_Cache, and I am using the APC opcode cache (which has
driven down memory usage considerably, but speed still remains an issue).

This kind of leads me down the path of guessing the CPU usage is the main
bottleneck. So, I made my XmlrpcController like so (with other setup
omitted, obv.):

public function indexAction() {
$overall_start = microtime(true);

$start = microtime(true);
$this-setClasses(); // sets about 10 classes into the server, for
about 150 (?) functions total
$elapsed = microtime(true) - $start;
API_Logger::debug(Got server in [$elapsed] seconds);

$start = microtime(true);
$ret = $this-server-handle();
$elapsed = microtime(true) - $start;
API_Logger::debug(Handled response in [$elapsed] seconds);

$overall_elapsed = microtime(true) - $overall_start;

API_Logger::debug(Overall request time [$overall_elapsed]);
API_Logger::debug();

die($ret);
}

Now, the interesting thing that I've discovered is that one client request
at a time seems to respond in a decent amount of time. My output looks like
so:
2008-10-16 22:38:36 INFO (6): [6313] Got server in [0.25338101387] seconds
2008-10-16 22:38:37 INFO (6): [6313] Handled response in [0.103404998779]
seconds
2008-10-16 22:38:37 INFO (6): [6313] Overall request time [0.360664129257]
2008-10-16 22:38:37 INFO (6): [6313]



However, when I make three requests to the same method at the same instant
(using firefox refresh all tabs, ha), each request is quite a bit slower:
2008-10-16 22:41:53 INFO (6): [6724] Got server in [0.860436916351] seconds
2008-10-16 22:41:53 INFO (6): [6465] Got server in [0.796639919281] seconds
2008-10-16 22:41:53 INFO (6): [6736] Got server in [0.816692113876] seconds
2008-10-16 22:41:53 INFO (6): [6465] Handled response in [0.284796953201]
seconds
2008-10-16 22:41:53 INFO (6): [6465] Overall request time [1.13558387756]
2008-10-16 22:41:53 INFO (6): [6465]

2008-10-16 22:41:53 INFO (6): [6724] Handled response in [0.300675868988]
seconds
2008-10-16 22:41:53 INFO (6): [6724] Overall request time [1.1651570797]
2008-10-16 22:41:53 INFO (6): [6724]

2008-10-16 22:41:53 INFO (6): [6736] Handled response in [0.293844938278]
seconds
2008-10-16 22:41:53 INFO (6): [6736] Overall request time [1.17823600769]
2008-10-16 22:41:53 INFO (6): [6736]



As I increase the number of simultaneous requests, the difference is more
and more drastic. As the requests to the API server start to pick up, the
box is brought to its knees pretty quickly. The CPU usage on the box is
pegged, while memory isn't that much of a problem. More hardware would help,
but not forever, if I want the API server cluster to start getting decent
3rd party usage.

So, my question is, is there something I can do? Can I put the server on a
ramdisk? Can I use memcached to cache $this-server in my example above? I'm
running this out of Apache, and would a more drastic move of trying lighttpd
and fastcgi be a path to explore (b/c php stays in memory)?

Failing all that, this is a plea for help. :)

thanks in advance,
- hoopes


Re: [fw-general] registering plugins per module/controller

2007-08-05 Thread Hoopes

ian,
that's a cool idea, but i guess my question is, how do i tell what 
module/controller/action i'm working with when i'm in the bootstrap 
index.php file?
what does the colon in the config section header do? I couldn't find 
anything about it in the parse_ini_file php.net page.

thanks for the response
- hoopes

Ian Warner wrote:


Hi

I use the config file, place this config array in config.ini.php or 
whatever you use, call it DEFAULT


[default]
plugins.Auth= true
plugins.Translation = true

Then for each project, controller or whatever delimiter you use, ie 
for admin you can dedide to remove a plugin, ie below the authn plugin 
is removed from the list


[admin : default]
plugins.Auth  = false

Then you can iterate through the plugins:

// Loop through the required plugins needed from the config.
foreach ($config-plugins as $k = $v) {

if (!empty($v)) {
$plugins[$k] = $v;
}
}

if (!empty($plugins)) {
return $plugins;
} else {
return false;
}

Hope that helps

I do the same for Modules also.

Ian

Hoopes wrote:

Hey,
I'm looking for a way to register plugins for the front controller 
based on what module (or controller) i'm being routed to. Basically, 
i'd like a subset of controllers throughout my app to all have 
certain data before they get started, without having to put the logic 
in preDispatch of every controller that needs it. getRequest() on the 
front controller doesn't get me anything.


I guess what i'm asking is, is there any way to determine what 
module/controller/action was called in the bootstrap index.php file? 
or another way to selectively register frontController plugins?


thanks
- hoopes



[fw-general] registering plugins per module/controller

2007-08-04 Thread Hoopes

Hey,
I'm looking for a way to register plugins for the front controller based 
on what module (or controller) i'm being routed to. Basically, i'd like 
a subset of controllers throughout my app to all have certain data 
before they get started, without having to put the logic in preDispatch 
of every controller that needs it. getRequest() on the front controller 
doesn't get me anything.


I guess what i'm asking is, is there any way to determine what 
module/controller/action was called in the bootstrap index.php file? or 
another way to selectively register frontController plugins?


thanks
- hoopes


[fw-general] consultants?

2007-07-11 Thread Hoopes

Hi guys,

Apologies in advance if this is not the place for this type of message, 
feel free to delete it if so.


My company is making a move from old code to a more framework oriented, 
standardized solution. (We'd like to bring in outside help, and our 
non-standard way of doing things takes more time to spin them up than 
get the work done). So, we're attempting to move to the ZF so hopefully 
the MVC-ness of it will allow people to come in and contribute more easily.


So, we're actually looking for someone to come to the office, and teach 
us a bit to get us started on this.
Specifically the Model part of the MVC, but overall education is the 
goal. :)


We're a Pittsburgh based company, and if anyone reading this has some 
time (and patience), and wants to try to make some money, please email 
[EMAIL PROTECTED] with any inquiries for further information.


Thanks
- hoopes