Review main Merged

51467[TASK] Allow generated BE user avatars to be cached

Claus Due CR +2 V +2 Normal +43 −28 updated 02/07/17, 16:54

Commit message

Given the assumption that this particular resource is not
one that changes very often one can benefit from storing
this in the cache_runtime in order to avoid fetching
the same avator more than one in a request.

Review

  • Code review CR +2
    • Benni Mack +2
    • Georg Ringer +1
    • Jörg Bösche +1
  • Verified V +2
    • Benni Mack +2
    • Georg Ringer +1
    • Jörg Bösche +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 2834

Show 79 earlier messages
  1. Claus Due uploaded patch set 1 01/30/17, 11:33

  2. TYPO3com voted on patch set 1 V +1 01/30/17, 11:37 Completed build in 04m 50s on Mon, 30 Jan, 12:37 PM Test Summary: 55655 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7212

  3. Benni Mack commented on patch set 1 01/30/17, 11:39

    a) I'm strongly against adding caches at wild, as I'm trying to reduce them. It is really hard for admins/integrators to understand the current caches alone. b) Shouldn't caching happen at the Avatar::class directly? c) Can't we use the "sys_processed file" caching mechanism to use?
  4. Claus Due commented on patch set 1 01/30/17, 12:03

    a) Okay - I think adding the tstamp of record to the hash makes that solid enough that in nearly every case (single use case I can think of: someone generates random and dynamic avatars) it will be completely invisible. b) Could be, at least it makes as much sense there. c) Since this isn't really a file being generated but rather a piece of HTML, I'd say no - but it is possible there's another cache that fits (which uses StringFrontend or a similarly "dumb" one).
  5. Thomas Hohn commented on patch set 1 01/30/17, 12:20

    I guess in most use cases - people don't use avatars? At least we don't - so I could live with at solution where the default avatar is cached. Fetching 500 records from the sys_log giving a performance overhead of nearly 4.5 seconds just to have a "dummy" avatar is in my opinion not acceptable.
  6. Claus Due uploaded patch set 2 01/30/17, 14:13

  7. Claus Due commented on patch set 1 01/30/17, 14:14

    Refactored so caching happens in the Avatar class, and refactored the Avatar class so that View initialisation does not happen when the avatar is cached.
  8. TYPO3com voted on patch set 2 V +1 01/30/17, 14:19 Completed build in 05m 42s on Mon, 30 Jan, 03:18 PM Test Summary: 55655 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7233

  9. Thomas Hohn commented on patch set 2 01/30/17, 14:25

    Once could give the cache a more generic name - making it possible to use it for other caching stuff - if one should be in need another time?
  1. Claus Due commented on patch set 2 01/30/17, 14:26

    Will wait for @Benni - maybe an existing cache can serve the purpose (and maybe that should then be renamed).
  2. Thomas Hohn commented on patch set 2 02/01/17, 06:26

    Any news here Benni? Is there another cache that could be used og a more generic cache name?
  3. Benni Mack commented on patch set 2 02/02/17, 20:11

    you could push it in Cache Core. Do you also have any stats why this is so expensive and how much?
  4. Benni Mack commented on patch set 2 02/02/17, 20:18

    ah, thanks Thomas for the comments. I will investigate this and keep you updated.
  5. Thomas Hohn commented on patch set 2 02/02/17, 20:26

    I my case - most records are created by the same user and hence the icon is the same - in my case the costs of just getting the images for 1000 records is 8 seconds. I can send you a screen shot from blackfire.io if you want - one before and one after the patch
  6. Thomas Hohn uploaded patch set 3 02/02/17, 21:47

  7. TYPO3com voted on patch set 3 V +1 02/02/17, 21:52 Completed build in 04m 45s on Thu, 2 Feb, 10:52 PM Test Summary: 55901 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7372

  8. Thomas Hohn commented on patch set 3 02/02/17, 21:52

    Caching it reduces the execution with approximately 40%! - I guess if the avatars are not locally even more. The cache_core is a no go - that "messed" up everything since it's HTML strings. So i renamed the cache to cache_strings in the first place :)
  9. Oliver Hader commented on patch set 3 02/03/17, 09:40

    Caching solves the problem of code being executed but raises internal complexity concerning states as Benni pointed out already. So, for this issue I think we can boil down the problems to * processing is called multiple times in the same request for each variant (backend user id) * avatar provider instantiation and ordering is called for each request Thus, I'd suggest the following: * create AvatarService (or AvatarRenderingProvider), behaving(!) as a singleton * instantiate and order avatar providers once * at runtime cache based on each backend user id "Singleton behavior" means to either use a local singleton scope or the global SingletonInterface as quick & simple solution.
  10. Claus Due commented on patch set 3 02/03/17, 10:16

    @Oliver I strongly disagree that the way to solve this one is to invent yet another manager/renderer/service/whatever. If you don't feel that my cache auto-invalidation measures are sufficient, I'm just as willing to consider using runtime_cache for this. > but raises internal complexity concerning states Your suggestion would, no offense, just move this exact same complexity concern to a new API which we would then also need to switch to. It would probably increase the amount of code changed by this patch, by several hundred percent... e.g. much, much more complex than an internal caching.
  11. Claus Due commented on patch set 3 02/03/17, 10:21

    NB: the "cache_strings" may in fact be generically useful enough to extract to a separate FEATURE - I have several extensions which currently declare exactly this type of cache because there's no core cache which handles pure strings.
  12. Thomas Hohn uploaded patch set 4 02/03/17, 10:42

  13. Benni Mack commented on patch set 5 02/03/17, 10:43

    Published edit on patch set 4.
  14. Benni Mack voted on patch set 5 CR +1 02/03/17, 10:44

  15. Thomas Hohn commented on patch set 4 02/03/17, 10:44

    Took the pragmatic solution :-)
  16. TYPO3com voted on patch set 4 V +1 02/03/17, 10:50 Completed build in 07m 44s on Fri, 3 Feb, 11:50 AM Test Summary: 55901 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7390

  17. TYPO3com voted on patch set 5 V +1 02/03/17, 10:52 Completed build in 08m 13s on Fri, 3 Feb, 11:52 AM Test Summary: 55901 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7391

  18. Georg Ringer commented on patch set 5 02/03/17, 11:27

    Avatar.php:53

    I would include the other parameters $size & $showIcon as well. otherwise this could lead to strange output
  19. Oliver Hader commented on patch set 5 02/03/17, 11:55

    @Claus: No offense, but I'm giving up...
  20. Thomas Hohn uploaded patch set 6 02/03/17, 12:10

  21. Georg Ringer voted on patch set 6 CR +1 V +1 02/03/17, 12:12

  22. TYPO3com voted on patch set 6 V +1 02/03/17, 12:16 Completed build in 06m 28s on Fri, 3 Feb, 01:16 PM Test Summary: 55901 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7394

  23. Jörg Bösche voted on patch set 6 CR +1 V +1 02/07/17, 08:11

  24. Benni Mack voted on patch set 6 CR +2 V +2 02/07/17, 16:54

  25. Gerrit merged patch set 6 02/07/17, 16:54