I am working on scalable solution for my code .
what i am doing right now is serving ads and keeping the impression and clicks on memcached and via cron pulling the clicks and impression every hour .
what i am doing right now is saving array on single key (rand key) and
saving the key on key name - 'keys' by append
than inside the cron i am doing a loop and saving all the keys inside the mysqli.
how can i improve this components ?
Unless you don't care about undercounting, storing data in memcache and expecting it to be there some time later isn't a viable approach. Memcache is a shared resource. Items in GAE memcache have have a highly variable lifetime depending on how other apps are treating memcache. It's a shared resource, best treated as a short-term, great-if-it's-there cache.