FOSHttpCache icon indicating copy to clipboard operation
FOSHttpCache copied to clipboard

Akamai support?

Open andrerom opened this issue 9 years ago • 13 comments

Just to start the discussion, anyone looked into feasibility of Akamai support?

Might also be interesting to support other CDN's as well, but Akamai is typically preferred choice among media companies and they often use it already.

andrerom avatar Dec 01 '14 17:12 andrerom

personally i never used akamai so i have little experience. let me just ask a bunch of questions:

  1. what would be the use case we can cover in this library? invalidating data on a cdn? anything else?
  2. are there any akamai/cdn client php libraries around? what would integration of those into FOSHttpCache bring?

dbu avatar Dec 01 '14 18:12 dbu

  1. That is about it. Unsure if purging by tag can be done, so might need to keep track of urls to tags using stash for instance.
  2. I couldn't find one for their Rest API which seesm to deprecate the soap api which is supported by https://github.com/stephanoff/php-akamai

andrerom avatar Dec 01 '14 21:12 andrerom

if akamai has no tagging, keeping an index on the application side sounds interesting. indeed that could share a lot with https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/issues/167 . but you would need to store the akamai tag stash somewhere else than in a cache folder - you do not want to loose that information, or you won't find your resources anymore.

dbu avatar Dec 02 '14 09:12 dbu

for 2) i think an akamai rest api should not be part of this library, that goes too far. so if you want to work on this, please check very well if there really is no such client, and then lets see if its more than 1-2 trivial calls we need and if so, start an akamai rest library in php that we can use here ;-) if its trivial calls, i can live with having them here.

dbu avatar Dec 02 '14 09:12 dbu

you do not want to loose that information, or you won't find your resources anymore.

true, good point

  1. ...

I'll pass the ball back to the customer that seemed interested in this, they might be up for contributing, or they might get in contact with Akamai about such a php rest client project.

andrerom avatar Dec 02 '14 10:12 andrerom

Making sure that the added feature covers at least 2 providers and is thus not bound to a single one: Edgecast is quite popular and has APIs for purge as well. To get started, see eg: https://kb.edgewebhosting.net/KnowledgebaseArticle53812.aspx, https://www.npmjs.org/package/edgecast

gggeek avatar Dec 02 '14 11:12 gggeek

And CDNetworks might make a good 3rd candidate. http://stackoverflow.com/questions/12725975/php-parse-xml-string-response-from-cdn-flush-api, https://github.com/blueboxgroup/cdnetworks-client/blob/master/README.md

gggeek avatar Dec 02 '14 11:12 gggeek

I don’t have much experience with such CDN providers myself. Just checking: do they really store HTTP responses? Or are they more about storing random chunks of data? We should remember this library is about HTTP caching. :wink:

ddeboer avatar Dec 02 '14 12:12 ddeboer

Yep, there is a risk of overdoing the scope of this bundle. SonataCacheBundle is also doing stuff with cdn's. What i totally see here is integration with some cdn library to use our mechanisms to invalidate paths, routes or tags.

But a multi-cdn client library would have to be separate or we start doing too many things in this library.

dbu avatar Dec 02 '14 12:12 dbu

Small update here, @kmadejski did a small prototype for eZ on this and there are some good news and some bad news:

  • Tagging is now supported, so it's possible to purge by that
  • We didn't see anyway so far to accomplish x-user-context-hash kind of feature, so it would be be limited to traffic to anonymous users it seems

For me those two features are kind of key for FOSHttpCache, so maybe that rules out adding support for it here unless someone sees a way.

andrerom avatar Mar 03 '20 16:03 andrerom

i am okay with having akamai support without the context hash in it. FOSHttpCache is also about cache tagging and invalidation of paths / banning. as long as documentation is clear what can be used and how (example config for akamai etc) i think its cool to have it.

dbu avatar Mar 03 '20 16:03 dbu

@dbu thanks for the reply. I think I can easily share what I did, but my current schedule is extremely busy. I will try to look into that in a couple of weeks.

kmadejski avatar Mar 03 '20 16:03 kmadejski

@kmadejski would be awesome if you can share / show it somewhere. a pull request with documentation would be very cool of course, but a blog post just explaining what you did and showing the files you did without integrating them into the repository here could be a start as well. then someone else who needs akamai support could maybe contribute the change, if you license your code accordingly.

dbu avatar Mar 04 '20 07:03 dbu