ZCE question

260 views
Skip to first unread message

Philip Norton

unread,
Apr 12, 2013, 10:25:27 AM4/12/13
to ph...@googlegroups.com
Hi all,

A colleague and I are currently working towards a ZCE. We downloaded a PHP 5.3 study guide from Zend, which has example questions that we look through every couple of weeks. I appreciate that this is a little out of date but we have been making our own questions and even bought Lorna Mitchell's excellent ZCE question pack (http://www.lornajane.net/project/zend-certification-questions-pack). 

Anyway, we were looking at this study guide this morning and came across this question):




Your PHP script is repeatedly parsing 50KB of data returned from a remote web service into browser-readable HTML.

Users complain that the script takes a long time to run. Which of the following measures usually leads to the best results? (Choose 2)

A: Install a bytecode cache.
B: Install an SSD drive on the server.
C: Cache the data returned by the web service locally.
D: Upgrade to the latest version of PHP.






I initially chose A and C which we both assumed was the right answer. We were a bit perplexed when the written answer for the question was C and D. 

I can accept C is the correct answer and that is a no-brainer. But I'm really struggling to understand how upgrading PHP can be the best choice over a bytecode cache here. I understand that new PHP versions are generally quicker than older versions, but it usually depends on what you are doing with PHP as different versions speed up in different areas. This contrasts to installing a bytecode cache that can increase speeds across all applications significantly, usually by orders of magnitude.

Is it just the case that this study guide is out of date and doesn't apply any more? Or am I just flat wrong?

What do you lot think? I would really appreciate feedback :)

Phil

Paul Waring

unread,
Apr 12, 2013, 10:38:48 AM4/12/13
to ph...@googlegroups.com
On 12/04/13 15:25, Philip Norton wrote:
> Your PHP script is repeatedly parsing 50KB of data returned from
> a remote web service into browser-readable HTML.
>
> Users complain that the script takes a long time to run. Which of the
> following measures usually leads to the best results? (Choose 2)
>
> A: Install a bytecode cache.
> B: Install an SSD drive on the server.
> C: Cache the data returned by the web service locally.
> D: Upgrade to the latest version of PHP.
>
> I initially chose A and C which we both assumed was the right answer. We
> were a bit perplexed when the written answer for the question was C and D.
>
> I can accept C is the correct answer and that is a no-brainer. But I'm
> really struggling to understand how upgrading PHP can be the best choice
> over a bytecode cache here. I understand that new PHP versions are
> generally quicker than older versions, but it usually depends on what
> you are doing with PHP as different versions speed up in different
> areas. This contrasts to installing a bytecode cache that can increase
> speeds across all applications significantly, usually by orders
> of magnitude.
>
> Is it just the case that this study guide is out of date and doesn't
> apply any more? Or am I just flat wrong?
>
> What do you lot think? I would really appreciate feedback :)

The only correct answer is to identify the bottleneck and take whatever
steps are required to fix that. Even server-side caching is not a
no-brainer if the problem lies between your server and the end user.

For example, if the web service is hosted in Sydney, your server is in
the UK and your users are in China, then upgrading PHP or installing a
bytecode cache are not going to have any effect on the latency
introduced by transferring the data half way around the world.

Depending on the circumstances, you could argue any combination of A, B.
C and D would lead to the 'best' result (once you've defined what you
mean by 'best' of course :).

--
Paul Waring
http://www.phpdeveloper.org.uk

David Goodwin

unread,
Apr 12, 2013, 10:43:15 AM4/12/13
to ph...@googlegroups.com
<snip/>

Your PHP script is repeatedly parsing 50KB of data returned from a remote web service into browser-readable HTML.

Users complain that the script takes a long time to run. Which of the following measures usually leads to the best results? (Choose 2)

A: Install a bytecode cache.
B: Install an SSD drive on the server.
C: Cache the data returned by the web service locally.
D: Upgrade to the latest version of PHP.



50Kb is a small amount of data, so I wouldn't expect 'B' to help very much.

My answer(s) would be 'A' and 'C'.

C - would remove any network latency - assuming this is possible in this circumstance.

A - would help speed up PHP's compile step - which /might/ help performance - depending on how the script is being called and what libraries it's using. 
Of course, if people are complaining the script is taking multiple seconds to run, then shaving a few 100ms off from using an op-code cache won't help much.

D - looking at performance graphs, the latest version of PHP is not the most performant. (See the random numbers at http://www.phoronix.com/scan.php?page=news_item&px=MTM0NjI ….)



Is it just the case that this study guide is out of date and doesn't apply any more? Or am I just flat wrong?


Study guide is incorrect.

We looked at those questions a day or so ago, and a number looked poorly written, incorrect or ambiguous or had what we could only tell were incorrect answers.


David.

Robert Mortimer

unread,
Apr 12, 2013, 1:13:16 PM4/12/13
to ph...@googlegroups.com

> --
> --
> You received this message because you are subscribed to the Google
> Groups "PHPNW" group.
> Post to list: ph...@googlegroups.com
> Unsubscribe: phpnw+un...@googlegroups.com
> Archive: http://groups.google.com/group/phpnw?hl=en
>
> PHPNW Website: http://phpnw.org.uk/
> twitter: http://twitter.com/PHPNW
> Events: http://upcoming.yahoo.com/group/4709/
> LinkedIn: http://www.linkedin.com/e/gis/112906/3FCE41597A1B
> Facebook: http://www.facebook.com/group.php?gid=17897252075
> IRC: #phpnw (irc.freenode.net)
>
> --- You received this message because you are subscribed to the Google Groups "PHPNW" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to phpnw+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Because rhe question states the thing about this script is the renote data call it asks us to make two assumptions

1: All other scripts are ok (It is not a local resource issue)

2: If this is the only diference then that's the issue you need to fix.

They can't write an essay for each questin so you sort of have to make these assumptions.

i.e. The problem must rest in the thing that is unique about this script.

Just my thoughts
Rob

Elliot Ward

unread,
Apr 12, 2013, 1:36:00 PM4/12/13
to ph...@googlegroups.com
Of course, if it were PHP 5.5 you'd already have a built-in opcode cache.


Rafal Jachimczyk

unread,
Apr 12, 2013, 1:47:05 PM4/12/13
to ph...@googlegroups.com
Hi All,

Hi to everyone! I have newer written to this group but was reading through for last couple of months. 

In my opinion the question is not well formed and misleading.

They don't tell us how often data on the remote severs is updated. If we simply cache the response without knowing this, the data cached might quickly become obsolete and we will run into much more problems than "script takes a long time to run".

I would personally only answer A) if i had not known the answer to the question above. 

Cheers,
Rafal 

Philip Norton

unread,
Apr 22, 2013, 11:52:19 AM4/22/13
to ph...@googlegroups.com
I was just clearing out my inbox when I realised that I hadn't replied back to this email to say thanks.

So I just wanted to say a belated note of thanks to everyone who responded. I talked about the responses with my colleague and we were pleased to know that we were both on the right track. Although we both agreed that the question doesn't really convey half the detail of what is needed in order to describe adequately what is going on.

Phil

Reply all
Reply to author
Forward
0 new messages