[google-appengine] cpu usage for getPersistenceManager?

2010-03-30 Thread charles eubanks
Included is the source of my entire servlet.  When I run this servlet
it says that I am using as much as
{"totalCpu":3671926.97333,"pmCpu":3671926.97333}

And to back up this my logs are telling me I am using a high amount of
CPU ( > 4600cpu_ms) and may soon exceed my quota. .

In any case am I doing something wrong?  It seems that if I am nearing
my max quota just getting the PersistenceManager then something is
just not right.

 I am not a paying user yet if that makes a difference.

Any clues for a newbie?

Thanks,

package reminder;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.jdo.PersistenceManager;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.simple.JSONObject;

import com.google.appengine.api.quota.QuotaService;
import com.google.appengine.api.quota.QuotaServiceFactory;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class NoopServlet extends HttpServlet {
/**
 *
 */
private static final long serialVersionUID = 1L;
private static final Logger log =
Logger.getLogger(NoopServlet.class.getName());

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException, IOException {
QuotaService qs = QuotaServiceFactory.getQuotaService();
long start = qs.getCpuTimeInMegaCycles();


JSONObject obj = new JSONObject();


SubqUser sUser = null;
start = qs.getCpuTimeInMegaCycles();
PersistenceManager pm = PMF.get().getPersistenceManager();
  long end = qs.getCpuTimeInMegaCycles();
 double cpuSeconds = qs.convertMegacyclesToCpuSeconds(end - 
start);
 obj.put("pmCpu", cpuSeconds);


   cpuSeconds = qs.convertMegacyclesToCpuSeconds(end - start);
   obj.put("totalCpu", cpuSeconds);
   System.out.println(this.getClass().getName()+" used  " +
cpuSeconds+ " cpu seconds");
resp.getWriter().print(obj.toJSONString());
}



@Override
protected void doPost(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(req, resp);
}

}

package reminder;

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;

public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("transactions-
optional");

private PMF() {}

public static PersistenceManagerFactory get() {
return pmfInstance;
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] CPU usage charges against datastore

2009-09-26 Thread RunningCloud

I wrote a script on a page to delete about 1500 entities by key. The
whole process took about 20 seconds over 3 or 4 web requests.

I was dinged about 25 minutes of CPU time, or about 75 times what it
actually took assuming I pegged an entire CPU during those 25
seconds.

My app is still under construction. I'd be hard pressed to believe my
datastore has been replicated to 75 systems around the world or is
the datastore a distributed megacluster with a 75x CPU charge no
matter what? Or is 100% CPU for one hour not really a "CPU hour"?

Need to know what is going on... I am all for paying for what I will
need but the accounting needs to be understandable.

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



[google-appengine] CPU usage suddenly very high

2009-06-19 Thread thegman

Hi All,
I've got a web service on App Engine which get's called every minute.
Normally, this request hits memcache and returns very quickly, with
very little CPU usage. Normally, I can run this for a day, and get
about 0.1 or 0.2 CPU hours used. I just happened upon my dashboard
today and saw that in the last hour, this request has happened about
90 times and used 9 hours of CPU times, this is hundreds of times more
CPU time than normal.

Is this a blip caused by the recent issues with App Engine, or is it
possible Google has been under-reporting my CPU time usage up until
now? My logs appear fairly standard, and nothing has really changed
that I can think of.

Any thoughts on the matter?

Cheers

Garry

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



[google-appengine] cpu usage

2009-01-07 Thread Ray Malone

Hi I get a message on my script that my average cpu is over 1300.
However, when I review the details I can't see any cpu time used or
any High CPU requests used.  Second of all my script is not all that
complicated and only makes 8 datastore api calls per request.  I'm not
sure where to look to tune it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---