Jan,<br>
<br>
Great! I can only image that your very busy, however, do you have any sort of time frame for this to be commited to CVS?<br>
<br>
Regards,<br>
Paul<br><br><div><span class="gmail_quote">On 5/30/05, <b class="gmail_sendername">Jan Janak</b> &lt;<a href="mailto:jan@iptel.org">jan@iptel.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 30-05-2005 14:11, Greger V. Teigre wrote:<br>&gt; See inline.<br>&gt; Jiri Kuthan wrote:<br>&gt; &gt;At 09:24 AM 5/30/2005, Greger V. Teigre wrote:<br>&gt; &gt;<br>&gt; &gt;[...]<br>&gt; &gt;&gt;&gt;* when ser starts up usrloc is &quot;lazy-loaded&quot;
<br>&gt; &gt;&gt;&gt;* if a usrloc record is looked up in cache and is __NOT__ found,<br>&gt; &gt;&gt;&gt;then MySQL will be queried. If found in MySQL then the usrloc<br>&gt; &gt;&gt;&gt;record will be put in to cache for future lookups
<br>&gt; &gt;&gt;&gt;<br>&gt; &gt;&gt;&gt;By doing these two things we should not have a problem we<br>&gt; &gt;&gt;&gt;excessively large subscriber bases.<br>&gt; &gt;&gt;&gt;<br>&gt; &gt;&gt;&gt;Thoughts?<br>&gt; &gt;&gt;
<br>&gt; &gt;&gt;Makes sense.&nbsp;&nbsp;This is how Berkeley DB and many other DBs work.&nbsp;&nbsp;In<br>&gt; &gt;&gt;fact, the best would be to build an abstraction cache layer around<br>&gt; &gt;&gt;all the query functions that have data in the DB. This way you would
<br>&gt; &gt;&gt;get the optimum performance/scalability.<br>&gt; &gt;<br>&gt; &gt;I have to admit I am not sufficiently familiarized with BDB. If I<br>&gt; &gt;understand it right, they do confgurable in-memory caching and they
<br>&gt; &gt;also support some kind of master-slave replication. I am not sure<br>&gt; &gt;though how this scales...(20 SERs with 20 BDBs, one of them master<br>&gt; &gt;and replicating UsrLoc changes to 19 slaves who are all able to
<br>&gt; &gt;identify inconsistent cache?)<br>&gt; &gt;<br>&gt; &gt;I mean the structural problem here is dealing with r-w intensive<br>&gt; &gt;Usrloc operations and still desiring to replicate for reliability.<br>&gt; &gt;There is a variety of algorithms to deal with it and I don't know
<br>&gt; &gt;well what the respective DB systems actually do.<br>&gt;<br>&gt; I'm not proposing to use BDB, it was just an example.&nbsp;&nbsp;Databases are very<br>&gt; good at replication, even two-way replication can be done quite efficiently
<br>&gt; through locking etc. I just took Paul's setup with cluster back-end as<br>&gt; granted and wrote my comments based on that...<br>&gt;<br>&gt; Thinking a bit wider and building on your comments, Jiri:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;The challenge, I think, is to handle the following things in any likely
<br>&gt; deployment scenario:<br>&gt; 1. Usrloc writes to cache vs. DB<br>&gt; 2. Replication of usrloc, multiple DBs vs. cluster, across LAN or WAN<br>&gt; 3. Memory caching management (inconsistencies etc)<br>&gt;<br>&gt; For the sake of the readers, here is how I understand SER's operations
<br>&gt; today:<br>&gt; 1. Usrloc is always written to cache, DB write is controlled through<br>&gt; write-through parameter<br>&gt; 2. Replication is handled by t_replicate<br>&gt; 3. Management of cache is not needed, the cache is always updated. However,
<br>&gt; an updated DB (and thus dirty cache) will not be detected<br><br>&nbsp;&nbsp;I am working on that already. The entries in the usrloc cache will<br>&nbsp;&nbsp;have an additional expires value and if that value expires then the<br>&nbsp;&nbsp;usrloc code will refresh it from the database. Also there will be no
<br>&nbsp;&nbsp;full cache anymore -- usrloc will cache only a portion of the whole<br>&nbsp;&nbsp;location database and old entries will be using LRU scheme.<br><br>&nbsp;&nbsp;The cache will be empty upon startup. When SER calls lookup then<br>&nbsp;&nbsp;usrloc will search the cache -- if there is no entry or if it is
<br>&nbsp;&nbsp;expired then it will load it from the database and store in the cache<br>&nbsp;&nbsp;for limited period of time. If there is no entry in the database then<br>&nbsp;&nbsp;it will create a negative cache entry (to limit the amount of<br>
&nbsp;&nbsp;unsuccessful database queries).<br><br>&nbsp;&nbsp;Database updates will not assume anything about the state of the<br>&nbsp;&nbsp;database so it should not matter if the entry still exists / does not<br>&nbsp;&nbsp;exists / has been modified..<br><br>
&nbsp;&nbsp;There is one drawback though -- nathelper as it is implemented right<br>&nbsp;&nbsp;now will not work anymore -- we would need to rewrite it to use the<br>&nbsp;&nbsp;contents of the database.<br><br>&gt; Here is how I understand Paul's proposal (and with my annotated suggestions
<br>&gt; from my last email :-):<br>&gt; 1. Usrloc is always written to DB, cache is updated if it is already in the<br>&gt; cache<br>&gt; 2. Replication is handled by underlying database across DBs or in a cluster<br>&gt; 3. If usrloc is not found, DB is checked. If cache is full, some mechanism
<br>&gt; for throwing out a usrloc is devised<br>&gt;<br>&gt; I must admit I often fall for the argument: &quot;let each system do what it is<br>&gt; best at.&quot;<br>&gt; Following that, replication should only be done at an application level if
<br>&gt; the underlying database is not capable of doing it (if we agree that a DB<br>&gt; is good at replication).&nbsp;&nbsp;The only thing I see a DB is not capable of, is<br>&gt; handling the NAT issues. So, if a given usrloc has to be represented by
<br>&gt; different location (ex. the registration server), then the DB cannot do<br>&gt; replication. However, if the NAT issue is handled through some other means,<br>&gt; ex. Call-Id aware LVS with one public IP, then the usrloc should be the
<br>&gt; same across DBs and the DB should handle the replication.<br><br>&nbsp;&nbsp;Another approach would be to let the user agent handle NATs. Sipura<br>&nbsp;&nbsp;phones, for example, can register with two proxy servers.<br><br>&gt; You don't need many subscribers before you'll want redundancy and as
<br>&gt; active-passive redundancy is a waste of resources, I believe an upgrade of<br>&gt; the replication mechanism should soon be imminent. ;-)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;I think I have said this before, but this is my enterprise-level &quot;dream&quot;
<br>&gt; scenario:<br>&gt; 1. Two geographically distributed server centers<br>&gt; 2. DNS SRV for load distribution (and possible using segmentation of<br>&gt; clients through their configurations if they don't support DNS SRV)
<br>&gt; 3. Each data center has Call-Id sensitive LVS in front, with one or more<br>&gt; servers at the back&nbsp;&nbsp;(a fair-sized LVS box can handle 8,000 UDP packets per<br>&gt; second)<br>&gt; 4. Each data center either has a DB cluster or two-ways SER-based
<br>&gt; replication<br>&gt; 5. The data centers replicate between each other using either DB-based<br>&gt; replication or two-ways SER-based replication<br>&gt; 6. The SER-based replication is an enhanced version of t_replicate() were
<br>&gt; replication is to a set of servers and replication is ACKed and guaranteed<br>&gt; (queue). I would suggest using the XMLRPC interface Jan has introduced<br>&gt; 7. I think Paul's cache-suggestions are good regardless of decisions on
<br>&gt; replication<br>&gt;<br>&gt; Entry level scenario where the same box is running LVS, SER, and DB (you<br>&gt; can quickly add new boxes) has a very low cost.<br>&gt;<br>&gt; &gt;&gt;&nbsp;&nbsp;However, there is one more thing: You need to decide on an
<br>&gt; &gt;&gt;algorithm for selecting a usrloc record to replace when the cache is<br>&gt; &gt;&gt;full.&nbsp;&nbsp;Do you store extra info in memory for each usrloc to make the<br>&gt; &gt;&gt;right decision (ex. based on the number of lookups).
<br>&gt; &gt;<br>&gt; &gt;You may also purchase more memory :)<br>&gt;<br>&gt; Do you suggest that no mechanism should be devised when the cache limit is<br>&gt; hit? ;-)&nbsp;&nbsp;Then maybe I can suggest an email alert to the operator when a
<br>&gt; certain amount of the cache is full... :-D&nbsp;&nbsp;I trust my people to act fast<br>&gt; and appropriate, but not that fast and appropriate!<br>&gt;<br>&gt; g-)<br>&gt;<br>&gt; _______________________________________________
<br>&gt; Serusers mailing list<br>&gt; <a href="mailto:serusers@lists.iptel.org">serusers@lists.iptel.org</a><br>&gt; <a href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a><br></blockquote>
</div><br>