appengineでの開発

Download appengineでの開発

If you can't read please download the document

Upload: najeira

Post on 31-May-2015

3.035 views

Category:

Technology


0 download

TRANSCRIPT

  • 1. appengine @najeira

2. http://labola.jp/ SNS

3. 4. 5. 1 Google App Engine 6. 1 PV/

7. DB Google App Engine 8. LAMP

  • CPU

9. 48GB 10. SSD 11. LAMP 48GB SSD RDB 12.

Google

  • Availability

99.9% 40

13.

  • Google

14. Google 15. 16. appengine 200ms 17. appengine www.example.jp img.example.jp 18. appengine 20ms 200ms 19.

20. 21. 22. 23. SSL 24.

25. 26. CDN Google Code 100ms? Amazon Cloud Front Akamai 27. HTTP

  • CSS JS 1

28. CSS 29. HTML CSS JS 30. URL src="/main.css?20100604" 31. Python CSS JS Apache dev_appserver 32. 33. Datastore Google App Engine Key-Value Store 34. Datastore JOIN

35. classUniv(db.Model): category = db.StringProperty() ... classStudent(db.Model): univ = db.ReferenceProperty(Univ) univ_category=db.StringProperty() ... #Student Univ student =Student ( univ = univ,univ_category=univ.category ) student .put() 36. #Univ category Student q = Student.all() q.filter( 'univ_category =' ,'national' ) students = q.fetch(10) 37. Datastore Java slim3 38. Datastore 39. 30 Google App Engine 1 40. Quota CPU CPU Datastore 41. RPC # ReferenceProperty NG forstudentinstudents: printstudent.univ.name# RPC(single get) #Key db.get keys = [] forstudentinstudents: keys.append(getattr(student.__class__, 'univ').get_value_for_datastore(student)) univs = db.get(keys)# RPC(batch get) forunivinunivs: printuniv.name 42. RPC # cache = memcache.get(name) ifcache: returncache # students = ...# RPC html = template.render( ' example .html',students = students ) memcache.set(name, html) returnhtml (HTML) 43. batch put #put forstudentinstudents: student.age = ...# #student.put() # RPC db.put(students)#batch put # RPC 1MB 44. keys_only #keys_only q = Student.all(keys_only=True) q.filter( ... ) keys = q.fetch(1000) 45. classDiary(db.Model): #created_at = db.DateTimeProperty(...) created_id= db.StringProperty() ... diary = Diary(...) diary.created_id ='%s|%s'% ( jst_now(), rand_str(len=10)) diary.put() 46. # q = Diary.all() q.order('-created_id') entities = q.fetch(10 + 1) diaries = entities[:10] if 10 < len(entities): next = entities[-1] else: next = None 47. # next q = Diary.all() q.order('-created_id') q.filter('-created_id