mstein / elasticsearch-grails-plugin

ElasticSearch grails plugin
Based on Graeme Rocher initial stub. Note that it is still in early stage.
Other
62 stars 164 forks source link

Performance unmarshalling components #42

Open richmarr opened 12 years ago

richmarr commented 12 years ago

Working on an app for a client that uses this plugin, I've come across a bit of a performance hit. Search results themselves come back from Elasticsearch very quickly, but it takes another ~10 seconds to finish unmarshalling the 33 hits in the response and pass the results back to my app code.

Each domain class being searched contains maybe a dozen component domain classes.

Adding a bit of logging seems to indicate that a lot of time (~4ms per property) is being spent on the call to BindDynamicMethod.invoke() in the DomainClassUnmarshaller.unmarshallDomain() method.

I can add a workaround or two so that the performance hit is less noticeable, but it seems like there should be scope to make this a bit more performant. Happy to help if you can give me some guidance as to how you'd prefer to go about it.

thch0014 commented 11 years ago

I prefer to not use unmarshalling, because it is too slow. I had implemented my own little function:

private org.elasticsearch.action.search.SearchResponse doSearchGetRawResponse(SearchRequest request, Map params) {

    elasticSearchHelper.withElasticSearch { Client client ->
        def response = client.search(request).actionGet()

        return response
    }
}

You can parse the result at your own. You are getting a "source" for every search hit. For me, the performace is good.