Jchem Structure search is very slow

User 73ad691ca3

15-04-2013 14:05:28

Dear Chemaxon Team,


Jchem search is taking more time to search a structure from a database table.  We are using "Jchem .Net API-Jchem searcher class" to search a structure.


According to the Jchem Cache Registration, Search will be faster except for the first time. But Jchem search in DotNet WCF service it is very slow.


Our Structure search Application is implemented in the following way (just an outline):


-->User will draw the structure in the Structure Editor from the Client browser. Then click the search button.


-->The request goes to the server(ASP.net Application hosted in the IIS server).


-->This will call the DotNet WCF service(SearchStructure WebMethod).


-->Then will call the Jchem .Net APIs for searching the structure. We are using the Jchem Searcher class to search the structure.


We are also using the Jchem Permanent Cache to increase the performance in searching. But we have doubt whether jchem is following this in searching(WCF service).


We have noticed the below issues from the Jchem - structure search:


1.  Jchem structure search is taking more time to search the structure for the 1st time. Next time it is fine.  But the next day it is slow (or) if we run the application next time it is very slow. we don't know the exact time for which it is taking more time.


2. Then After some time, if we do the structure search, jchem is taking more time to search.


 


So what we are looking is, 


-->Jchem should take less time to search the structure from the structure table.


-->As we are using the Jchem .Net API & DotNet WCF services, we are looking some workflow/some sample code to perform the structure search much faster using the Jchem.


(such as initiate call from WCF service, setting license, cache registration, creating the connection handler, creating the jchem searcher object, run the jchem search, get the hits, return the results back to the WCF service.)


Please reply us regarding this ASAP.


Below is the sample code:


wcf service will call the GetCdIdsByStructure method:


public static class Searcher

    public static int[] GetCdIdsByStructure(JChemSearchOptions searchOptions, ConnectionHandler conh, string tableName, string molStr)
    {


//set license path-jchem



        //-->register permanent cache
        String identifier = "unique_cache_identifier";


            CacheRegistrationUtil.setPermanentCacheID(identifier);


        //-->register permanent cache
       
        int[] cd_ids = null;
        try
        {
            JChemSearch searcher = new JChemSearch();
            searcher.setConnectionHandler(conh);
            searcher.setStructureTable(tableName);
            searcher.setSearchOptions(searchOptions);
            searcher.setRunMode(JChemSearch.RUN_MODE_SYNCH_COMPLETE);


            //-->to search in a new thread
            JavaThread thread = new JavaThread();
            thread.RunNew();
            //-->to search in a new thread


            searcher.setQueryStructure(molStr);
            searcher.run();
            cd_ids = searcher.getResults();
            searcher.cleanResults();    //clean


            return cd_ids;
        }
        catch
        {
            throw;
        }
    }


}


---------------------------------------------------------------------------------------------------


 


Thanks & Regards,


D. Senthil kumar vijai.


 


 

ChemAxon d9cc14700b

16-04-2013 07:14:01

Dear Customer,


JChem uses an internal cache for searching. This cache is loaded before the first search, which may take some time, hence the slow first search, but subsequent searches should be much more faster. As this cache is kept in memory it exists only for the lifetime of the virtual machine (IKVM in case of .NET environment). This means if the application is restarted, then the first search will trigger cache load again.


There is also cache eviction, which means tables which were not used recently for searching might be dropped in case of JChem is low on memory.


So, my questions are:


Did you restart your application between before experiencing the slow search? Do you run searches on multiple tables?


Thanks and Regards,


Gabor