the missing piece of info is that Saurabh is running on google app engine. it's obvious to me only because i deal with this lots....
Saurabh - some things you can try: - use a GAE backend instance. it can have unlimited time to process the request, though it does not have unlimited memory. - use the GAE files API to write data to a blobstore. i seem to have the impression that you can't open a file for append though. - use taskqueues with one or both of the above to divide the data into chunks to process - email the user the link to the blobstore file when the CSV is generated. good luck! cfh

