How to server video content fast

76 views
Skip to first unread message

Ankur Jatt

unread,
Jul 2, 2015, 12:25:23 PM7/2/15
to google-a...@googlegroups.com
Currently I'm using below class to serve videos:

class VelfieVideoHandler(blobstore_handlers.BlobstoreDownloadHandler):

    def get(self, blobKey):
        blobKey = BlobKey(blobKey)
        blobinfo = blobstore.blobstore.BlobInfo(blobKey)
        self.send_blob(blobKey,content_type="""video/mp4""")

But the problem is: its taking atleast 2 seconds to response even though the video size is 100KB.
I test this code on 4Mbps speed and from Mumbai.

How can I optimize it?

Jim

unread,
Jul 2, 2015, 3:21:22 PM7/2/15
to google-a...@googlegroups.com
Ankur,

I use that same basic approach to serve thousands of blobs per day in my app, and the average response time in the app engine logs is 15ms.  The blobs I'm serving are text data and they vary in size from a few hundred bytes  to 1MB and larger.  The average size is probably around 200KB.  

I wonder if anyone can comment on the possibility that the blobstore service takes longer to serve video content than it does text content.  I doubt it, but I suppose it is possible.

Are you sure that the latency you're seeing is actually in app engine and not perhaps in network transit or even in your browser while it loads a viewer for that mp4 content?

Jim

Ankur Jatt

unread,
Jul 3, 2015, 4:56:07 AM7/3/15
to google-a...@googlegroups.com
Hello Jim,
Well when I saw the response time from GAE than its same around from 15ms-80ms. ANd the response metrics I attached, plz have a look. The main thing is browser is taking too much time to parse content and, as you can see in attached file. But I'm unable to figure out how to solve this problem.
Untitled.png

Jim

unread,
Jul 4, 2015, 11:41:25 AM7/4/15
to google-a...@googlegroups.com
It looks like you're losing a half second in the response phase, which is probably network transit time from the app engine server to Mumbai.  Last time I checked the only options for specifying the region for deployment with app engine were US and Europe.  Do you see that same ~500ms latency hit on other types of content coming from the US?

But your big hit is in the Load Event which I assume is where your video player is loading.  What player are you using?  Could you get better performance from another video player?  Could you pre-load the video player while your user is busy doing something else so that he/she doesn't experience the load time as a delay?

Ankur Jatt

unread,
Jul 11, 2015, 12:04:28 PM7/11/15
to google-a...@googlegroups.com
Hello Jim,
Yes you are write main time is spending in loading event. Currently I'm using html5's default video player. Could you please suggest me some good video players please. Or help me out in finding some good video play code etc.
Reply all
Reply to author
Forward
0 new messages