Elasticsearch .NET Nest API vs HTTP RESTful API performance - performance

I'm new in elasticsearch. we have a project with a lot of user interaction. Backend of the project is ASP.NET MVC and frontend is Angularjs. Backend and Frontend communicate with WEB API.
We use SQL Server for data storage and we'll use elasticsearch for Search Engine and retrieving data from server.
Elasticsearch can work upon of Nest and javascript API, is there any difference in performance between Nest and JS API (Specially in very big and complicated queries)?

NEST, the high level Elasticsearch .NET client, uses Elasticsearch's json REST API through Elasticsearch.Net, the low level .NET client, and exposes all of the endpoints with strong types, using JSON.Net for serialization.
Elasticsearch.Net itself does not expose all endpoints with strong types but can work with string, byte[], object, and string, byte[] and object collections. It uses a simple json serializer to handle serialization so has no dependencies on any other serialization library.
NEST aims to be a fast client that "just works" for any scenario in which you want to use Elasticsearch. If you're using a limited subset of the API, you may be able to improve serialization with custom serializers using something like JIL, and, if the approach is generic, we'd love to know to see if it could be rolled into NEST. You can write your own json serializer by implementing IElasticsearchSerializer.

Related

Use GraphQL with in existing spring boot rest api

We have few existing rest apis written in spring boot to fetch different data in our project? Now we are exploring options to use GraphQL. But we don't want rest endpoints & response to change since it is being consumed by many UI/backend applications. Can anyone suggest proper way to use GraphQL within existing API without changing rest endpoints and Response type?

Nested GraphQL servers / microservices

I would like to replace all my REST APIs with GraphQL (apollo-server preferred). It's clear to me how to use GraphQL in monolithic apps but it's not clear how to do it for microservices.
The main API server consists of multiple microservices where each microservice exposes its own REST API through which the central API server communicates with it. I would like to replace all these REST APIs with GraphQL thus I would get microservices as nested GraphQL servers communicating with each other through GraphQL instead of REST.
The problem that I'm facing is how to easily build a GraphQL query string for microservices based on the received attributes in the resolver of the main GraphQL server. There is no way to tell GraphQL to return all the fields for microservice. The best way would be to simple forward just a part of a the main query further to a microservice.
Any ideas? Do you think that REST is still more appropriate for microservices then GraphQL?
I can suggest you to use WAMP protocol and then build a network of all of your functionality.
Finally serve it under 1 GraphQL server

Use BreezeJS and JayData Without OData

Can we use BreezeJS or JayData, with all of their features without OData (i.e using only ASP.NET Web API but without OData)?
Breeze already supports this as it's default. Breeze, by default, uses an OData format over the wire for query purposes, but this does NOT require that the server be implemented as an OData service. The standard Breeze WebApi server controller can understand this format without you having to implement an OData service. ( the same is true of our Mongo and Ruby server examples).
In fact, most of the Breeze examples show Breeze communicating directly with ASP.NET Web Api without using any of the WebApi OData implementation.

Spring Data Rest - Caching

How to enable caching with Spring Data Rest?
The reasoning behind is that repository listing and search methods won't change once the application is up. Also if the data behind the rest API is changed only through rest API it does makes a case to enable caching data too.
I believe some level is caching happens in REST API framework and it would be ideal if the caching happens at the final response stage i.e., json response (to avoid the overhead of marshalling objects to json)
Thoughts/comments?
The easiest way to implement this on the repository level is to use Spring's #Cacheable as it can be seen in the Spring Data JPA Examples project.
Another option is to leverage HTTP Caching using the Apache HTTPD settings or a Varnish for example.

Tool to report rest interfaces

We have a web application using Jersey and Spring's rest template. Does anyone know of a tool that can scan a code base and produce a report that lists all exposed endpoints and also internal references to those endpoints?
You may also take a look at Swagger, a framework for describing, producing, consuming, and visualizing RESTful web services.
Swagger supports multiple REST frameworks and also JAX-RS based on Jersey.
From their GitHub Wiki:
The Swagger framework simultaneously addresses server, client, and documentation/sandbox needs for REST APIs. As a specification, it is language-agnostic. It also provides a long runway into new technologies and protocols beyond HTTP.
With Swagger's declarative resource specification, clients can understand and consume services without knowledge of server implementation or access to the server code. The Swagger UI framework allows both developers and non-developers to interact with the API in a sandbox UI that gives clear insight into how the API responds to parameters and options. Swagger happily speaks both JSON and XML, with additional formats in the works.
Jersey can provide a WADL report at the /application.wadl URI. It doesn't document complex types but at least gives you a list of endpoints.
See https://wikis.oracle.com/display/Jersey/WADL

Resources