Performance for Product Developers

34
Matthew Wilkes Performance for Product Developers 1 Friday, 12 October 12

description

 

Transcript of Performance for Product Developers

Page 1: Performance for Product Developers

Matthew Wilkes

Performance for Product Developers

1Friday, 12 October 12

Page 2: Performance for Product Developers

Who am I?

•Performance and security work at the Code Distillery

•Framework and security teams, membership committee

•Foundation board member

2Friday, 12 October 12

Page 3: Performance for Product Developers

Who am I?

•Zope / Plone core developer

•Silly accent. Sorry.

•Not a morning person. Sorry.

3Friday, 12 October 12

Page 4: Performance for Product Developers

Performance…

•Plone is pretty damn fast

•Low edit sites are really easy to make fly

•Runs fine on a 256mb VM

4Friday, 12 October 12

Page 5: Performance for Product Developers

Performance…

•plone.app.caching takes about 5 minutes to configure

•Add Varnish and it goes really rather quick

•Writing is harder

5Friday, 12 October 12

Page 6: Performance for Product Developers

Performance…6Friday, 12 October 12

Page 7: Performance for Product Developers

… for Product Developers?

7Friday, 12 October 12

Page 8: Performance for Product Developers

… for Product Developers

•Security isn’t the sole responsibility of the integrator

•Neither is performance

•Everyone is careful about the code they write

8Friday, 12 October 12

Page 9: Performance for Product Developers

some even over do it9Friday, 12 October 12

Page 10: Performance for Product Developers

Recap

•Don’t add things to the catalog if you can help it

• If you have to, use an indexer, not just a raw FieldIndex

10Friday, 12 October 12

Page 11: Performance for Product Developers

Recap

•Build your types on Dexterity, not Archetypes

• If you’re not sure what structure to use for your data, the answer is OOBTree

11Friday, 12 October 12

Page 12: Performance for Product Developers

Recap

•Avoid big object churn by keeping Lengths of things you need

•Find a balance between huge objects and annotation soup

12Friday, 12 October 12

Page 13: Performance for Product Developers

Recap

• If you see for loops inside for loops you’re probably missing a simpler way

•Don’t forget sets and itertools, they’re good

13Friday, 12 October 12

Page 14: Performance for Product Developers

… for Product Developers

•Very few people are using the tools we have available

•Equally true for publicly available products as for policies

14Friday, 12 October 12

Page 15: Performance for Product Developers

Who’s used this?15Friday, 12 October 12

Page 16: Performance for Product Developers

You guys! Seriously‽16Friday, 12 October 12

Page 17: Performance for Product Developers

I love this chart

0ms

20ms

40ms

60ms

80ms

without cache:ruleset with cache:ruleset0

23

0

56

Access time for a browser view through Varnish

connectprocessing

17Friday, 12 October 12

Page 18: Performance for Product Developers

plone.app.caching

• Assign caching rules directly to contexts by interface

•Can map to an operation, like plone.app.caching.strongCaching

• or to a ruleset, like plone.content.itemView

18Friday, 12 October 12

Page 19: Performance for Product Developers

psst, integrators!

•You can have commit accesstoday

• If your favourite product doesn’t have rulesets defined, add them

• I’ll bring “I cleaned up your mess” stickers to Brasília

19Friday, 12 October 12

Page 20: Performance for Product Developers

Edge Side Includes

photo (c) http://www.flickr.com/photos/fornal/20Friday, 12 October 12

Page 21: Performance for Product Developers

ESIs

•Varnish is your friend

•Lets integrators do page composition

•but easy to leak data

21Friday, 12 October 12

Page 22: Performance for Product Developers

22Friday, 12 October 12

Page 23: Performance for Product Developers

ESI

•Suddenly, cache hits for logged in users!

• aaaand, cache hits on private pages for anonymous

•Really rather bad

23Friday, 12 October 12

Page 24: Performance for Product Developers

ESI

•Set ETags to roles|lastModified?

•ETags can be faked

•Still leaks data

24Friday, 12 October 12

Page 25: Performance for Product Developers

ESI

• Integrators will still have to segment their cache manually

•Hard work

•A lot easier if add-ons are written with this in mind

25Friday, 12 October 12

Page 26: Performance for Product Developers

ESI

•Plan your templates for eventual ESIs

•Many small templates is appropriate, lets them be customised

26Friday, 12 October 12

Page 27: Performance for Product Developers

ESI

• If there is a block of markup that is mostly static but uses the user in some bit, make sure that’s separated out

• Integrators shouldn’t need more than a few minutes to add ESI to your templates

27Friday, 12 October 12

Page 28: Performance for Product Developers

Testing caching

photo (c) http://www.flickr.com/photos/alisdair/28Friday, 12 October 12

Page 29: Performance for Product Developers

Testing

•Far too few people run automated tests on their caching

•Well, far too few people run automated tests at all

29Friday, 12 October 12

Page 30: Performance for Product Developers

Testing

• If you have plone.app.testing based tests already it’s easyish

•Create a new layer using a ZServer and start up Varnish

•Make some testbrowser calls

30Friday, 12 October 12

Page 31: Performance for Product Developers

Things that need building

31Friday, 12 October 12

Page 32: Performance for Product Developers

Utility packages

•We need helper classes and methods for writing caching tests

•Actual tests in popular packages, as examples

32Friday, 12 October 12

Page 33: Performance for Product Developers

Rulesets

•The current plone.app.caching rulesets are integrator focused

•We need some standard ones for product developers to use

33Friday, 12 October 12

Page 34: Performance for Product Developers

The Code DistilleryBristol

Questions?

Want help putting this into [email protected]

34Friday, 12 October 12