Recovery Web services using Java, Apache Axis2, Hibernate, and MySQL and its performance

I read somewhere using webservcies in applications. After many studies, I can create one web service that will accept Json and JsonP both the request format and the response, respectively. I developed webservcies using Java, Apache Axis2, Hibernate, and MySQL as a database. there are several problems, and I don’t know how to solve them?

  • Insert or delete a parameter, sometimes if at that time more than two users call this service, which inserts or deletes any row, the requests go into sleep mode, and the next time someone tries to get this service, he could not. Summing up the server log, he talks about SQL Lockout State error. If I check the Processlist in MYSQL, it will show this query in a dream, I have to kill to resume.

  • The performance of the webservice does not seem to match the value, it takes more time, because what I tested should not. In simple words, how to get better performance with services

  • How to implement a security function, so that if a user enters a login, they can be provided with an identifier and verification of this identifier so that unauthorized access can be prevented.

Or just call me what should be the most suitable and optimized Webservice methodology that you can use with Java

+4
source share
5 answers

The answer to this question does not apply to Android. Below are my studies that may be useful to you.

Due to the fact that MySQL connections go into sleep mode, you can do the following.

  • Debug the data source used by Hibernate, try increasing the pool size and checking for any problems.
  • Define a waiting period for connections. JBoss has several configurations related to this, for example blocking-timeout-millis, idle-timeout-minutesetc.
  • . OracleStaleConnectionChecker .
  • miniumn . , , , .

/ SQL, , . , .

. :

-, , , . , , .

  • . lopp.
  • . GC.

, . PMD, FindBugs, JMeter, Java .

+2

, . YourKit . visualvm, JDK, .

, - :

  • HTTP-
  • HTTP
  • (, - /)

, , , A B C D C B -. , , /, .

YourKit, . (, ). , , HTTP-, , . YourKit, , .

, . HTTP, wget, , , IDE webservice (, intellij), HTTP.

, , . Chrome Firefox , .

, . Grails - ( , - Grails/ Groovy, , -, , Grails ... , )

, , , -, . Spring MVC DropWizard ( JAX-RS), Grails .

- , , .

, MySQL? InnoDB? MyISAM? . MySQL.

, , , , X, (, , )

+1

Java , /, - - REST Spring MVC.

:

0

Spring, - RestFul, Spring . , web- , Android.

: https://spring.io/guides/gs/rest-service/

0

:

  • API . API , ;
  • Use a lightweight HTTP server. A powerful HTTP server may consume more.
  • Use a stream. You will have more threads if you encounter tons of users.
  • Make more things static. You can avoid unnecessary requests.

I think mhoglan's answer is quite detailed.

0
source

Source: https://habr.com/ru/post/1527444/


All Articles