For what it's worth, I have done similar approaches of having an XML file or 
files of sort of static configuration like this and I query it at runtime every 
time. Performance has always been extremely good, even when there are several 
entries. For example, I have one file that has all the language codes for the 
2- and 3- char codes that are queried every request. I also have other 
situations where rules are saved in the DB as separate XML files and they are 
all queried at runtime and the time it takes to do that doesn't even register 
in the profiler (0sec). If the queries use the index, then I think this is a 
great approach. It's easy to maintain and the code is understandable. Plus it 
works across all nodes.

-Ryan
From: jhun...@marklogic.com
Date: Mon, 16 May 2011 08:37:04 -0700
To: general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] Map API Advantage



You could store it as XML, then make a map out of it, and use 
xdmp:set-server-field() to save the map in memory between requests.  Use 
xdmp:get-server-field() to retrieve it later.  On server restart you'll have to 
regenerate the map.  You'll also have to generate and save the map once on 
every E-node.  Note that the map is associated with the entire host, not just 
the app server.
-jh-
On May 16, 2011, at 3:25 AM, Abhishek53 S wrote:

Hi All 



I have my master
lookup data XML inserted into Marklogic .



<states>

     
  <state>

     
          <code>AL</code>

     
          <desc>Alaska</desc>

     
  </state>

     
  :

     
  :

</states>



I have two ways to
get the description through code



     
  Construct the map with the codes and values and use the
map API to get the description.

     
  

     
  Every time  traverse the XML to get the description
through code.



Can any one suggest
 keeping performance in mind which one is better approach? Is there
any other approach to do this (using any in-built indexing mechanism)?



Abhishek Srivastav

Systems Engineer

Tata Consultancy Services

Cell:- +91-9883389968

Mailto: abhishek5...@tcs.com

Website: http://www.tcs.com

____________________________________________

Experience certainty.        IT Services

                
       Business Solutions

                
       Outsourcing

____________________________________________=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general                         
                  
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to