demexp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Demexp-dev] Questions


From: David MENTRE
Subject: Re: [Demexp-dev] Questions
Date: Thu, 18 Oct 2007 19:32:04 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Hello Lyu,

Lyu Abe <address@hidden> writes:

>> BTW, please note that there is no guarantee of the demexp server to
>> sort the list in a specific order (the current reverse order comes
>> from the current sequence of processing in the server, that might
>> change in the future). Each question contains its question number
>> (parameter q_id, qu['q_id'] in your code) and you should sort the list
>> according to that.
>
> Yes, I was thinking about that. There is also a method to retrieve
> questions by their IDs, right?

You can use question_info() to get a specific id:
  question_info(cookie, q_id, 1)


> Do you have any comments on which method
> is preferable? (or not)

It depends heavily on your web framework and your web application logic.

If you display a single question (e.g. details on a question), it is
simpler to call a question_info() for the needed id and then do the
display.

If you want to list several questions, it is more efficient to use
question_info() to get needed information by groups (e.g. 200, use the
constant MAX_NUMBER_IDS [see demexp book ยง3.2.1] that you can get with
constants() RPC) and then extract and merge relevant information on
those groups.

If you can save some states somewhere, a MySQL database like in
Augustin's code or a global variable in mod_python, you can save the
whole details returned by question_info() in your own data structure and
use them at a later time when needed.

You mileage my vary a lot. ;-)

As a rule of thumb, if you want to have good performance you need to
have the minimum number of calls to demexp server. Each time you call
the demexp server, you add a small latency (10 to 500 ms, depending on
demexp server location and responsiveness) that directly degrades you
web server performance (10 calls at 500 ms gives 5s of added latency,
might be quite long for a user). It is said in GUI literature that user
interface should respond below 500 ms to seems responsive enough to the
user.

Best wishes,
d.
-- 
GPG/PGP key: A3AD7A2A David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A




reply via email to

[Prev in Thread] Current Thread [Next in Thread]