Php client
flag
Messages 31 - 40 of 93 - Collapse all
/groups/adfetch?adid=a7EHMg4AAABnyCyrFRkiDGqjAqH17USG
Php client - Email updates to me  
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
1.  avip  
View profile  
 More options Nov 7 2008, 2:53 pm
From: avip <avital.pek...@gmail.com>
Date: Fri, 7 Nov 2008 11:53:36 -0800 (PST)
Local: Fri, Nov 7 2008 2:53 pm
Subject: Re: Php client
Hi Tim,

Not sure if you've already spotted this typo or not but in function
__call(..) you have
"do_my_server" instead of "_do_my_server" (underscore in front).

Also, I'm not sure if this is my misunderstanding of PHP, the way you
planned it, or an actual error but: peek_ready() accepts only a write
back variable, not a server name; in the code you do an array_shift()
in hopes of getting the server name. So, elsewhere, if someone tried
doing just $beanstalk->peek_ready($nextJob); it would fail...

On Oct 14, 5:53 pm, "FaceySpacey.com" <jamesgillm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
2.  Tim Gunter  
View profile  
 More options Nov 7 2008, 3:06 pm
From: "Tim Gunter" <icyliq...@gmail.com>
Date: Fri, 7 Nov 2008 15:06:13 -0500
Local: Fri, Nov 7 2008 3:06 pm
Subject: Re: Php client
Hi,

Thanks for pointing that out. I need to roll a new release soon, just
havent had the spare time.

Regarding your questions, I think it's just a misunderstanding.

$beanstalk refers to a pool of servers, and is represented by the
BeanStalk class. Calling peek_ready() on $beanstalk expects a server
name and optional writeback.

$beanstalk then routes the peek_ready() call internally to an actual
server instance, represented by a BeanQueue object. THIS peek_ready()
does not need a servername parameter, and therefore only accepts the
writeback.

Since array_shift modified the passed array, the top level
peek_ready() only sends the writeback to the internal peek_ready, as
the servername as already been shifted off.

Does that make sense?

- Tim

--
I may have lost my way now
Haven't forgotten my way home

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
3.  avip  
View profile  
 More options Nov 7 2008, 4:11 pm
From: avip <avital.pek...@gmail.com>
Date: Fri, 7 Nov 2008 13:11:25 -0800 (PST)
Local: Fri, Nov 7 2008 4:11 pm
Subject: Re: Php client
Hi,

Wow, that was a fast turn-around! I thought it would take days :)
Thanks for both explanations, now that I read them (and after poking
in the code for a while), it seems pretty "obviously necessary" to
tell the function which server to perform the peek on given there's a
pool.

I've been trying some very basic PHP scripts to learn the internals, I
have one script that puts a job onto the server (I manually verify
it's there with a telnet session). Then the following:
<code>
    require('bin/Others/BeanStalk.class.php');
    $beanstalk = BeanStalk::open(array('servers' =>
array('127.0.0.1:11300'),'select' => 'random peek'));

    $beanstalk->use_tube('test');

    $nextJob = '';
    $ret = $beanstalk->peek_ready('127.0.0.1:11300',$nextJob);

    if ($ret === 1)
    {
        echo 'PEEK OPERATION OK<br/>';
        echo 'Next ready job='.$nextJob.'<br/>';
    }
    else {
                echo 'PEEK OPERATION FAILED<br/>';
           }
</code>

I also turned debugging on and some simple debugging echos to
peek_ready(). Result:

Normal output from "if (BeanStalk::DEBUG) echo __METHOD__."\n";":
--------------------------------------------------------------------------- -------------------------
BeanStalk::__call(use_tube)
BeanStalk::_do_my_server
BeanQueue::use_tube
BeanStalk::__call(peek_ready)
BeanStalk::_do_my_server

Output from extra echo statements I added:
--------------------------------------------------------------------------- -------------------------
peek_ready(): in_writeback=127.0.0.1:11300 <--first line in function
JOB=I was here <--output right after "$job = $this-

>read_message($data[1]);"

Writeback variable provided <--from inside of "if (!
is_null($in_writeback))"
Output from code pasted above:
--------------------------------------------------------------------------- -------------------------
PEEK OPERATION OK
Next ready job=

Not sure why this is happening, could be some type of misunderstanding
on my end again. Any ideas as to what I may be doing wrong?

Thanks for a great lib and the feedback by the way! Much
appreciated :)
--Avi
On Nov 7, 3:06 pm, "Tim Gunter" <icyliq...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
4.  Tim Gunter  
View profile  
 More options Nov 7 2008, 4:15 pm
From: "Tim Gunter" <icyliq...@gmail.com>
Date: Fri, 7 Nov 2008 16:15:38 -0500
Local: Fri, Nov 7 2008 4:15 pm
Subject: Re: Php client
Hey,

Yeah this is an issue with beanstalk clients like mine, and beanstalkd
1.0. I was trying to implement a polling check that could pull the
next ready job from a pool, but peek() didn't turn out to work as I
initially expected.

Avoid the peek modes for now. Stick to 'sequential wait' and 'random
wait' select values.

I will release v1.1 of my client shortly, and then the peek modes will
work again, as expected.

--
I may have lost my way now
Haven't forgotten my way home

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
5.  avip  
View profile  
 More options Nov 7 2008, 4:33 pm
From: avip <avital.pek...@gmail.com>
Date: Fri, 7 Nov 2008 13:33:45 -0800 (PST)
Local: Fri, Nov 7 2008 4:33 pm
Subject: Re: Php client
Ah! Of all the functions, I choose this one to test first with :)

Will avoid the peek modes until next version, as suggested.

Thanks again!
--Avi

On Nov 7, 4:15 pm, "Tim Gunter" <icyliq...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
6.  avip  
View profile  
 More options Nov 8 2008, 12:30 pm
From: avip <avital.pek...@gmail.com>
Date: Sat, 8 Nov 2008 09:30:47 -0800 (PST)
Local: Sat, Nov 8 2008 12:30 pm
Subject: Re: Php client
Hi again Tim,

Running into some basic problems: I have a script that loads the queue
with some jobs using put(), this works fine and is verified manually
via telnet. In a different script, I attempt to reserve a job using:

<code>
    require('bin/Others/BeanStalk.class.php');

    $beanstalk = BeanStalk::open(array('servers' =>
array('127.0.0.1:11300'),'select' => 'random wait'));

    $beanstalk->use_tube('test2');

    $job = $beanstalk->reserve();
    echo "job=".print_r($job,true);

    BeanStalk::delete($job);
</code>

Almost straight out of the example, only difference is that put() and
reserve() are spread out across two files. I've tried every select
mode as well with similar results.

BeanStalk::__call(use_tube)
BeanStalk::_do_my_server
BeanStalk::reserve
BeanQueue::reserve
Fatal error: Maximum execution time of 30 seconds exceeded in /bin/
Others/BeanStalk.class.php on line 989

Since I added some echos to original, my line 989 is: $data =
@fread($this->socket,$in_buf_size);

Is this related to the problems from yesterday? Also, you mentioned
v1.1 will be released soon, could you be more specific? (weeks?
months?) I'm just trying to figure out whether or not I should try the
python or other libs for now.

Thanks!
--Avi
On Nov 7, 4:33 pm, avip <avital.pek...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
7.  avip  
View profile  
 More options Nov 9 2008, 3:56 pm
From: avip <avital.pek...@gmail.com>
Date: Sun, 9 Nov 2008 12:56:57 -0800 (PST)
Local: Sun, Nov 9 2008 3:56 pm
Subject: Re: Php client
Hi yet again!

Scratch the last post. I spent more time experimenting with a telnet
session and reading the protocol itself more carefully.

For any other people who are completely new to beanstalkd and are like
me - wanting to go from installing server to writing code - take note:
the "use <tube>" command is *just* for producers. Attempting to
"switch tubes" using "use <tube>" and then reserve will not work and
actually block if the default tube is empty, not to mention confuse
you like it did me. The command you're actually looking for when you
wish to *consume* jobs is "watch <tube>"

Very important-and much farther down the protocol doc-is the
following:

The "watch" command adds the named tube to the watch list for the
current
connection. A reserve command will take a job from any of the tubes in
the
watch list. For each new connection, the watch list initially consists
of one
tube, named "default".

Take my code from above as example, seems like it should work because
it's almost straight from the example. My first mistake was assuming
that. I ran the example first, it worked fine without any error, but
running it several times in a row after my own code failed, I noticed
it was erratically timing out. When it wasn't timing out, it behaves
the way I described in the post prior to this one, just silently
returns with no actual action taking place.

Both the example or the example code above will timeout not because of
any PHP-specific error but because doing "use_tube('test2')" doesn't
actually *switch* tubes in order for you to consume from that job-
queue - that is managed by the daemon for you provided you tell it you
wish to *watch* that tube. Not the most obvious thing to realise upon
initial inspection!

So, in the above piece of code I pasted, reserve() is actually trying
to ask for a job from the tube "default" (created automatically),
since it is empty (because in a previous piece of code I, correctly,
used "use_tube('test2')" to add jobs), the function just blocks...in
other words, the would-be consumer waits for a job; however, PHP times
out the script based on its own timer.

If you wish to consume jobs using PHP scripts in the background
elsewhere without this time limit simply add "set_time_limit(0)" to
the top of the relevant PHP script to allow for infinite time - this
will allow your consumer scripts to run in the background indefinitely
until there is a job to be done.

Anyway, using "watch" fixes the problem for me, I hope this post saves
someone a few hours of confusion.
Tim, if you could correct me on anything I got wrong... :)

Thanks!
--Avi
On Nov 8, 12:30 pm, avip <avital.pek...@gmail.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Memory usage with 1.1 on OS X Leopard Server - Email updates to me  
1.  Mike Czepiel  
View profile  
 More options Nov 13 2008, 12:30 pm
From: "Mike Czepiel" <czep...@gmail.com>
Date: Thu, 13 Nov 2008 09:30:16 -0800
Local: Thurs, Nov 13 2008 12:30 pm
Subject: Memory usage with 1.1 on OS X Leopard Server

Out of curiosity has anybody seen excessive memory usage with beanstalkd on
OS X Leopard Server.We're running 1.1 and seeing the memory footprint up
around 760+MB with 2.07GB of virtual memory after a few hours of running.

I'm working with my system admin to revert back to an older beanstalkd to
see if it was a problem then as well and they just hadn't noticed it.

We're launching beanstalkd with launchd set to keep-alive. Initially there
is only 400KB of memory wired but after a few hours with minimal jobs
submitted the memory use for the process is well above 700MB.
We're running beanstalkd without the -d argument so launchd handles the
daemon stuff.

Any suggestions? Things to try?

Thank you,
mike


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
2.  rezedit  
View profile  
 More options Nov 13 2008, 2:26 pm
From: rezedit <reze...@gmail.com>
Date: Thu, 13 Nov 2008 11:26:39 -0800 (PST)
Local: Thurs, Nov 13 2008 2:26 pm
Subject: Re: Memory usage with 1.1 on OS X Leopard Server

Aforementioned system admin here.  We actually see the memory usage
double every time it goes up.  So far it seems to correspond to when
jobs are submitted.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
3.  Keith Rarick  
View profile  
 More options Nov 14 2008, 5:31 am
From: "Keith Rarick" <k...@xph.us>
Date: Fri, 14 Nov 2008 02:31:14 -0800
Local: Fri, Nov 14 2008 5:31 am
Subject: Re: Memory usage with 1.1 on OS X Leopard Server

On Thu, Nov 13, 2008 at 9:30 AM, Mike Czepiel <czep...@gmail.com> wrote:
> Any suggestions? Things to try?

Can you send the output of a "stats" command on one of these overgrown
beanstalkd instances?

I'm trying to reproduce it here. I'm submitting one job per second
without deleting any. Does this resemble your use patterns? I'll let
it run overnight and see what happens.

kr


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2013 Google