You said nothing about your enviroments (e.g. operating systems, what kind of Oracle installation you have, whar kind of SOLR installation, how many data in database, how many documents in index, RAM for SOLR, for Oracle, for OS, and in general hardware...and so on)...

Anyway...a migration from Oracle to SOLR? That is, you're going to throw out the window Oracle and completely replace it with SOLR? I would consider other aspects first before your performace test...unless you have one flat table in Oracle, you should explain to your manager that there's a lot work that needs to be done for that kind of migration (e.g. collect all query requirements, denormalization)

Best,
Gazza


On 09/04/2013 02:06 PM, Sergio Stateri wrote:
Hi,

I´m trying to change the data access in the company where I work from
Oracle to Solr. Then I make some test, like this:

In Oracle:

private void go() throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
PreparedStatement pstmt = conn.prepareStatement("SELECT DS_ROTEIRO FROM
cco_roteiro_reg_venda WHERE CD_ROTEIRO=93100689");
Date initialTime = new Date();
ResultSet rs = pstmt.executeQuery();
rs.next();
String desc = rs.getString(1);
System.out.println("total time:" + (new
Date().getTime()-initialTime.getTime()) + " ms");
System.out.println(desc);
rs.close();
pstmt.close();
conn.close();
}



And in Solr:

private void go() throws Exception {
String baseUrl = "http://localhost:8983/solr/";;
this.solrServerUrl = "http://localhost:8983/solr/roteiros/";;
server = new HttpSolrServer(solrUrl);
  String docId = AddOneRoteiroToCollection.docId;
  HttpSolrServer solr = new HttpSolrServer(baseUrl);
SolrServer solrServer = new HttpSolrServer(solrServerUrl);

solr.setRequestWriter(new BinaryRequestWriter());
SolrQuery query = new SolrQuery();
  query.setQuery("(id:" + docId + ")"); // search by id
query.addField("id");
query.addField("descricaoRoteiro");

extrairEApresentarResultados(query);
  }

private void extrairEApresentarResultados(SolrQuery query) throws
SolrServerException {
Date initialTime = new Date();
QueryResponse rsp = server.query( query );
SolrDocumentList docs = rsp.getResults();
long now = new Date().getTime()-initialTime.getTime(); // HERE I CHECHING
THE SOLR RESPONSE TIME
  for (SolrDocument solrDocument : docs) {
System.out.println(solrDocument);
}
System.out.println("Total de documentos encontrados: " + docs.size());
System.out.println("Tempo total: " + now + " ms");
}


"descricaoRoteiro" is the same data that I´m getting in both, using the PK
CD_ROTEIRO that´s in Solr with name "id" (it´s the same data).
Solr data is the same machine, and Solr And Oracle have the same number of
records (arround 800 thousands).

Solr aways returns the data arround 150~200 ms (from localhost), but Oracle
returns arround 20 ms (and Oracle server is in another company, I´m using
dedicated link to access it).

How can I tell to my managers that I´d like to use Solr? I saw that filters
in Solr taks arround 6~10 ms, but they´re a query inside another query
that´s returned previosly.


Thanks for any help. I´d like so much to use Solr, but I really don´t know
to explain this to my managers.



Reply via email to