Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59430 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50022 invoked from network); 7 Apr 2012 17:13:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2012 17:13:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=luke@cywh.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=luke@cywh.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cywh.com from 209.85.220.170 cause and error) X-PHP-List-Original-Sender: luke@cywh.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:44731] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/4C-23111-E95708F4 for ; Sat, 07 Apr 2012 13:13:03 -0400 Received: by vcbfo14 with SMTP id fo14so1413495vcb.29 for ; Sat, 07 Apr 2012 10:13:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=references:from:in-reply-to:mime-version:date:message-id:subject:to :cc:content-type:x-gm-message-state; bh=bubbUXm7cSmlGnURfNCpOthwb3X5I433c1+gUt7zuw8=; b=CVKOAWInWnxmjhoiT3x1p3ErSTICjLSRDUJOima0Q45d2g0m4psv2/fYIqoQB9a3h0 ceM4nfs5AKZOs1beUBTjq1x/5Ym5/7EHq5dDlauCramqXRCaw1l4PD8s/FfzLui6gGx4 NnaCB9NzzAWCNw3tnGJFlSlsoodxcd8h+Isy70ulCoS/NW+P3BOGUHjMJ0jYsvAM+cqd FeKEqBTJ3zeqLx8/hHDFFr4eyhS8z2uxWHedrkNw3khP8kF/IqRn3d3vUKlkhFW/PFvU fdaIBcZ5mPNAMy8YsZtJdJ6D+wejyg3MtZzeR4OhZo2sn/WbGFD14JMONwhsBTZCW54Y r7Xg== Received: by 10.52.65.134 with SMTP id x6mr741981vds.60.1333818779959; Sat, 07 Apr 2012 10:12:59 -0700 (PDT) References: <2082600.13123.1333758215113.JavaMail.mobile-sync@iaje9> <7714055974799768995@unknownmsgid> <3194191830858287831@unknownmsgid> In-Reply-To: Mime-Version: 1.0 (1.0) Date: Sat, 7 Apr 2012 10:12:57 -0700 Message-ID: <3744281415074182327@unknownmsgid> To: Pierre Joye Cc: =?ISO-8859-1?Q?Johannes_Schl=FCter?= , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQlpGdidNub7K60xp1Bh/0OY1GczGCEAh/KtEb9d2Fo/bKM+W6m8y2RJSEQyB6+E9pMT0x1P Subject: Re: [PHP-DEV] Persistent zvals From: luke@cywh.com (Luke Scott) On Apr 7, 2012, at 9:45 AM, Pierre Joye wrote: > hi, > > On Sat, Apr 7, 2012 at 4:59 PM, Luke Scott wrote: > >>> The expensive parts here are not the object creation on its own but to >>> get the data they contain (external, calculation, etc.). >> >> With heavy objects, yes. But when you have hundreds of objects? The >> unseralization process in no more efficient than creating the objects >> directly. > > That's what I am saying, yes. Hence that I do not think persistent > objects are that much helpful. I guess it depends on the use case. > >> It depends. It's only cheaper when you have heavy objects. >> >> How do other platforms with a persistent application instance handle this? > > It is horrible in Java. There are some work being made in JS (server > side) too which looks good, but it is basically the same as we discuss > here. Are we talking about v8cgi or Node? Node has a single application instance, but everything has to be asynchronous... > >> I think the bigger issues are how to persist the memory without >> fragmentation. Stanislav talked about that (although those comments >> didn't make it to the list - my fault for not hitting reply all). > > Then post it again here. Done. > >>> The serialization method can be optimized easily, igbinary for example >>> can help to speed up this process. >> >> Optimized, sure. But you can only go so far. You still have the cost >> of recreating those objects. The only way to make it truly zero is by >> not recreating them. > > Right, but the gain is not worth it except in hello world example. > Well, for the large majority of the use cases. In a hello world the difference is probably not measurable. When you start to see it is with hundreds of class instances. > >> igbinary helps. But what about a large binary tree? The only way to >> efficiently keep this in memory (currently) is to write a C/C++ >> extension that persists the memory as a resource. But this takes much >> more time and effort than writing it in PHP. > > I wonder about the opportunity and design correctness to keep large > binary trees in memory, but that's maybe another discussion :) I personally don't, but it was one of the use cases I found where serialization had no benefit. > > >> With a lot of large frameworks you spend more time initializing the >> framework than the request itself (besides querying external resources >> like MySQL). > > In most if not any applications, "(besides querying external resources > like MySQL)" is what takes the largest part of the request time. > That's why I do not think persistent zval is going to bring us that > far. True, for most PHP applications today. But when you hit these limitations you often have to work outside PHP and bind that solution to it. Whereas java, as "horrible" as it is, can handle almost any situation. A classic example of something I couldn't do in PHP: Large file uploads (> 2GB). Our solution was writing an app in java, powered by jetty, to stream the file to the server. It works beautifully , but it had to be done outside PHP. > > >> I think the most frustrating thing for me is knowing this isn't an >> issue with web applications written in Java, which has an always on >> application instance that handles requests. I've always viewed java as >> bloated and slow... But with recent developments of Java being jit >> compiled to native code, these issues are starting to go away. > > It is not really what I see. Many projects I have seen have been > moving away from persistent objects across requests (for the part you > are referring to here), as it adds an insane amount of complexity that > is not worth the effort. I suppose it depends on the industry. In the credit card processing industry (gateways) I see Java a lot. I almost never see PHP in this area. Luke > > Cheers, > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org