4
votes

My website (www.nykidplaces.com) is hosted on Google App Engine.

Loading the homepage is sometimes very slow, 10 seconds or more. After some profiling, I've noticed that the problem is typically caused by loading a static file (css, javascript, or images). Most static files load quickly, but occasionally one random static file will load very slowly.

For example, this 4Kb file usually takes < 200ms to load, but occasionally takes much longer:

while true; do time wget http://www.nykidplaces.com/styles/toastr.css --quiet; done

real 0m0.163s

real 0m0.154s

real 0m3.335s slow

Any ideas about what could be causing this?


My .yaml file:

version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /images
  static_dir: images
- url: /styles
  static_dir: styles
- url: /javascript
  static_dir: javascript
- url: /.*
  script: daycares.application

libraries:
- name: webapp2
  version: latest
- name: MySQLdb
  version: "latest"
- name: jinja2
  version: latest
1
Ran your while true; do time wget http://www.nykidplaces.com/styles/toastr.css --quiet; done command for at least a minute on multiple VPS servers in US+EU and the response time never went above real 0m0.351s with avg about real 0m0.093s. May be the problem is in your internet connection?Mihail Russu
Thanks for the response! Are you sure you were aggregating the responses right? I've tried this from several hosts and the results are quite consistent. Here's a loop that will run 100 times and spit out only the responses that took more than one second. It consistently happens about 5% of the time for me: for i in {1..100}; do /usr/bin/time -f "%e" wget www.nykidplaces.com/styles/toastr.css --quiet 2>&1 | grep "[1-9]\."; doneEmily Eustis
The second command you provided didn't work for me on OSX but I came up with this: for i in {1..100}; do (time wget www.nykidplaces.com/styles/toastr.css) 2>&1 > /dev/null |grep real; done | sort -r and while most of the time the max would be about real 0m0.775s with min at real 0m0.090s, after running the command several times I did get 3-4 results ranging from real 0m1.097s to real 0m3.697s. Sorry, but I am not sure why that happens, I know this doesn't answer your question but considering that it took over 1 second only 4 times out of ~500 requests I don't think it's bad.Mihail Russu
I have had this problem intermittently as well so it is not only you Emily.gaefan

1 Answers

0
votes

It shouldn't be that slow but I noticed your static file is using the default 10 minutes cache expiry time. You could set it to higher say 1 day to make use of the very fast edge cache for static files (if they don't need to be updated frequently)