Nope, single memcached entry per api request otherwise you won't get
as good performance

say api call is http://soasite/blabla?gdfgd=gfdgfd

and response is

<response>
<artist>artist1</artist>
<artist>artist2</artist>
<artist>artist3</artist>
.....
</response>


what we do is:

api client

apicall:
   if not in memcached key = hash(apiuri)
   response=call(apiuri)
   store in memcached(key) = response
   return response
   else
   return memcached get(key)


I wouldn't recomend store all the apis of one page, 1 block can change
inside the page and you would get a memcached miss
Don't worry about having 10 - 20 memcache calls per page

Cheers


On Fri, Oct 31, 2008 at 6:44 PM, MP <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Thanks for the reply. Please confirm if I am reading this right:
>
> You "concatenate" the responses from all the different api calls and
> cache it as one "object" in memcached? This makes sense....this way on
> every request you make just one network call to fetch all the cached
> data. But doesn't memcached have a limit of 1MB on cache item?
>
> Thanks
>
> MP
>
> On Oct 31, 1:26 pm, "Juanse Pérez Herrero" <[EMAIL PROTECTED]> wrote:
>> Hi, I am doing something like that.
>>
>> Our site is built up with functional blocks (top, categories, new
>> contents...), representing the data from different api calls.
>> What we do is to cache the api calls, we use a hash of the api call as
>> the key and inside we store the response,
>> usually xml or serialized objects.
>>
>> It works great.
>>
>>
>>
>> On Fri, Oct 31, 2008 at 6:16 PM, MP <[EMAIL PROTECTED]> wrote:
>>
>> > Hi,
>>
>> > I've not used Memcached in my applications before; but I'm considering
>> > it for my current project especially for its distributed nature. I
>> > would like to get this group's help in formulating a right solution
>> > based on their experiences in using Memcached .
>>
>> > My application has a page (similar to igoogle, facebook etc) that has
>> > many modules (Top News module, Group Photos, etc). Each module gets
>> > its data from different data sources (all web services). All modules
>> > show the most up-to-date data. Traditional way of implementing this
>> > would be to generate html "fragments" for each module and cache it in
>> > memory and serve it from memory on every request.
>>
>> > If I were to use memcached (where memcache servers are different from
>> > the app servers), then on every request I'll have make multiple
>> > network calls (from app server to memcache servers) to fetch the
>> > cached data.
>>
>> > Has anyone used memcached for similar implementations? If so, is there
>> > a better approach? Or is memcached not the right approach when we want
>> > to fetch multiple caches on every page load?
>>
>> --
>> Juanse Pérez Herrero
>> --http://www.linkedin.com/in/juanseph



-- 
Juanse Pérez Herrero
--
http://www.linkedin.com/in/juanseph

Reply via email to