I have a rest service which is exposed to end user. This service sends response(say 500K) and the response times are high.
How can we use Gzip to compress the response and send.
I'm using Spring boot and maven.
Thanks in advance.
The GZIP configuration was updated in Spring Boot release 1.3. Now, the correct handling is to use server.compression.enabled property.
server.compression.enabled=true
See the Enable HTTP response compression chapter in the reference docs for configuration details such as response size and content type. Please read the Release Notes for the motivations of this change.
Spring boot allows you to simply configure tomcat to use compression via your application.properties/yaml
server.tomcat.compression: on
(for more options see http://docs.spring.io/spring-boot/docs/1.2.3.RELEASE/reference/htmlsingle/#how-to-enable-http-response-compression)
Look at your container. Many will do this for you transparently at the server level, you shouldn't have to do anything at all with your code.
Consider this Tomcat example.
Related
A spring integration project pulls emails from Exchange Server using imap-idle-channel-adapter; it transforms the message; it invokes some SOAP webservices and persists data in DB using Spring Boot and JPA. All works fine.
This needs to be deployed in a four-weblogic-server cluster environment.
Could someone please help with some hints on what needs to be done? Is there any configuration needed?
As long as your logic is just like you show and there is no any more endpoints polling shared resource, your are good so far do nothing more. The mail API has built-in feature to mark messages in the box as read or at least seen, so other concurrent session won’t poll those messages again.
I am able to decompress the request using filter but I want some configuration or application parameters so to handle decompression of POST requests.
Tomcat does not support request decompression. There is an enhancement request that may result in it being supported in the future. Your best option is to use a filter as you have been doing.
I just created simple Zuul Proxy at the front end for our microservices environment but now I wanted to log all the entries into the log file which went through the proxy.
Do any properly which I need to enable to do this.
I assume an implementation of zuul as a regular spring boot driven microservice with a bunch of netflix's beans running under the hood.
In this case it can run on tomcat (probably for other services the idea is the same, but the technical implementation might be different).
So for tomcat:
As a first resort you can take advantage of tomcat feature of "access logs" that logs all the requests anyway. It also allows some level of customizations (what to log). The technical difficulty is that tomcat access log is not by default managed by logback, so you'll have to use some kind of adapter.
Here you can find ideas of how to resolve this technically and integrate access log with logback.
An another approach would be creating a Filter that will extract required pieces and log the request / response / whatever you want to log
Here is an example of creating a custom filter like this.
Of course I you also need to log something from response you should configure the filter type (see the java code example in the link)
One tip / caution: think about performance implications, so that this feature won't slow down the processing if the server is under high load of requests.
Currently I'm using SCS with almost default configuration for sending and receiving message between microservices.
Somehow I've read this
https://www.confluent.io/blog/enabling-exactly-kafka-streams
and wonder that it is gonna works or not if we just put the property called "processing.guarantee" with value "exactly-once" there through properties in Spring boot application ?
In the context of your question you should look at Spring Cloud Stream as just a delegate between target system (e.g., Kafka) and your code. The binders that enable such delegation are usually implemented in such way that they propagate whatever functionality supported by the target system.
I have configured the HTTP Authorization Manager, but for some reason it only logs in if HTTPClient3.1 is selected as the implementation of my HTTP Request. Furthermore it does not seem like JMeter sends the information at all if Java or HTTPClient4 is selected. I'd like to know why that is the case.
Is it possible to change the configuration in one of the .properties files to get it to work with HTTPClient4? Especially since HTTPCLient3.1 is no longer being developed, and support for this may be dropped in a future JMeter release.
This is a limitation of JMeter as of 2.13 version, see:
https://bz.apache.org/bugzilla/show_bug.cgi?id=57242
Java Implementation does not support this.
Rest assured HttpClient 3.1 will not be dropped soon from JMeter.