Sure. This is just some code borrowed from our Google I/O presentation on
App Engine so we elided some stuff and there might be a typo here and there.
If you haven't seen that presentation, it might be worth your while to
Youtube it.

On Thu, Aug 20, 2009 at 5:36 PM, Vince Bonfanti <[email protected]> wrote:

>
> Beautiful! I really needed this--thanks.
>
> But, "Delegate" is an interface, so I think the ProfilingDelegate
> needs to look something like this:
>
> import com.google.apphosting.api.ApiProxy.Delegate;
> import com.google.apphosting.api.ApiProxy.Environment;
> import com.google.apphosting.api.ApiProxy.LogRecord;
>
> class ProfilingDelegate implements Delegate {
>     Delegate parent;
>    public ProfilingDelegate(Delegate parent) {
>      this.parent = parent;
>    }
>    public byte[] makeSyncCall(Environment env, String pkg, String
> method, byte[] request) {
>      long start = System.nanoTime();
>      byte[] result = parent.makeSyncCall(env, pkg, method, request);
>       log.info(pkg + "." + method + ": " + System.nanoTime() - start);
>      return result;
>    }
>    public void log(Environment env, LogRecord logRec) {
>        parent.log(env, logRec);
>     }
> }
>
> On Thu, Aug 20, 2009 at 12:02 PM, Toby Reyelts<[email protected]> wrote:
> > You'll need to profile two separate things:
> > 1) Compute-bound execution
> > 2) Time spent in rpcs to our services
> > 1) Compute-bound performance should be in the same rough ballpark on the
> > dev_appserver as our production servers. You can use any standard Java
> > profiler on your dev_appserer to measure this.
> > 2) Time spent in services is going to vary wildly between production and
> the
> > dev_appserver. For example, the datastore for the dev_appserver is just
> an
> > in-memory store with periodic writebacks. The datastore for production is
> a
> > distributed database. You can measure these times in production using a
> > profiling ApiProxy.Delegate:
> > class ProfilingDelegate extends Delegate {
> > Delegate parent; public ProfilingDelegate(Delegate parent) { this.parent
> =
> > parent; } public byte[] makeSyncCall(Environment env, String pkg, String
> > method, byte[] request) { long start = System.nanoTime(); byte[] result =
> > parent.makeSyncCall(env, pkg, method, request); log.log(INFO, pkg + “.” +
> > method + “: “ + System.nanoTime() - start); return result; } }
> > ApiProxy.setDelegate(new ProfilingDelegate(ApiProxy.getDelegate()));
> > If you're feeling particularly aggressive, you can use the App Engine
> status
> > site in conjunction with an ApiProxy.Delegate to come up with an
> estimation
> > of how much time you'll spend in RPCs on the production and even insert
> > corresponding sleeps into your dev_appserver.
> > On Thu, Aug 20, 2009 at 5:17 AM, mar_novice <[email protected]>
> wrote:
> >>
> >> is there a way to do profiling with google app engine java?
> >>
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to