Well Duh, You are generating a JPG, you said "send the bytes" but you are
modifying, rendering, and compressing a JPG.  That takes some CPU.

My app sends jpgs and uses no CPU as it were because it really is "do I have
this? Oh I do? Great here it is" 

Your app is "Hey Draw me a pretty picture" "Um... Ok let me do that for
you....You probably want that as a JPG not a BMP let me compress that....
Let me save it to a blob incase you need it later...  here you go"

It's the difference between having an intern running a photo copy and asking
Me to paint you a picture of you with my cat.   And now I'm certain you are
using APIs which have a minimum CPU per action cost.

Likely if these are one time use images, you should just write them, no
blob.
These are small, so likely if you need to keep them around you should write
them to data store
If you only kind of need them sometimes, consider memcache so you don't have
to clean up in a week when you have lots of these.



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of stevep
Sent: Saturday, May 14, 2011 3:06 PM
To: Google App Engine
Subject: [google-appengine] Re: What's going on with my CPU times

Thanks Brandon. Every image is unique, and is generated by users from the
client. So statics limitations make it infeasible.

Right now I think this has to do with the on/off again hits. I went into my
Dashboard after a few individual calls, and saw I had gone from 3 resident
instances: 3 resident and 3 dynamic. Although this was serving a query rate
of 0.018 per second. My average instance latency was 65ms I think.

Have no idea what the resident instances are doing. But guess will wait and
see.

Cheers,
stevep

On May 14, 12:27 pm, "Brandon Wirtz" <[email protected]> wrote:
> Put it not in a blog.
>
> Consider using Static (depending what else you are doing)
>
> With out code it is hard to tell what you are doing but you may be 
> using API cpu and not "CPU" Cpu
>
> Most of my CPU bill is API.
>
>
>
> -----Original Message-----
> From: [email protected]
>
> [mailto:[email protected]] On Behalf Of stevep
> Sent: Saturday, May 14, 2011 8:04 AM
> To: Google App Engine
> Subject: [google-appengine] What's going on with my CPU times
>
> Can anyone help me understand these CPU times.
>
> I have an on-line handler function that basically does a get_by_id(), 
> and sends out the bytes for a 150x100 pixel jpeg BLOB record value. A 
> pretty straightforward image retrieval from the datastore.
>
> My CPU loads are all over the map. I am $9 paying for 3 instances to 
> stay resident. An instance takes just less than 15 meg of RAM. Very 
> low volumes right now, so maybe that affects this?
>
> Looking at AppStats, the function itself is consistently taking 200ms 
> or less for every call. So how am I getting 13,000ms for this simple
function?
>
> I've copied/pasted a series of calls for this image below. Here is an 
> extract of the last 4 url calls:
> 242ms...80cpu
> 351ms...13,740cpu
> 466ms....4,903cpu
> 182ms....2,922cpu
>
> Looking at the full list below, I only occasionally get fast cpu 
> times. This is the simplest function, can't imagine where the 
> inefficiencies are. Is the HR datastore that slow at pushing a small 
> payload of bytes out the door? Man oh man, averaging these cpu times 
> for a 150x100 pixel jpg, I better switch my image saves/retrieves to
> S3 mucho soon.
>
> Thanks in advance,
> stevep
>
> 2011-05-14 07:20:10.949 /cardimage/59005_t.jpg 200 242ms 80cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-14 07:03:04.967 /cardimage/59005_t.jpg 200 351ms 13740cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 14:50:48.065 /cardimage/59005_t.jpg 200 466ms 4903cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 13:57:09.990 /cardimage/59005_t.jpg 200 182ms 2922cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 10:39:27.922 /cardimage/59005_t.jpg 200 196ms 1474cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 09:01:08.347 /cardimage/59005_t.jpg 200 494ms 777cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 08:13:33.672 /cardimage/59005_t.jpg 200 501ms 435cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 07:23:52.577 /cardimage/59005_t.jpg 200 371ms 117cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 07:06:09.403 /cardimage/59005_t.jpg 200 880ms 1585cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 05:39:36.415 /cardimage/59005_t.jpg 200 728ms 6460cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 03:17:36.456 /cardimage/59005_t.jpg 200 413ms 1252cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-13 00:55:52.879 /cardimage/59005_t.jpg 200 683ms 191cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-12 22:42:57.523 /cardimage/59005_t.jpg 200 342ms 796cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-12 22:06:37.960 /cardimage/59005_t.jpg 200 77ms 66cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-12 22:03:02.608 /cardimage/59005_t.jpg 200 301ms 99cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-12 22:00:49.586 /cardimage/59005_t.jpg 200 393ms 118cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-12 21:54:47.092 /cardimage/59005_t.jpg 200 220ms 45cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
> 2011-05-12 21:54:45.633 /cardimage/59005_t.jpg 200 90ms 46cpu_ms 
> 8api_cpu_ms 35kb facebookplatform/1.0 (+http://
> developers.facebook.com),gzip(gfe),gzip(gfe),gzip(gfe)
>
> --
> You received this message because you are subscribed to the Google 
> Groups "Google App Engine" 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
athttp://groups.google.com/group/google-appengine?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to