This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Perfomance concerns on using thirdparty libraries to create RESTful webservice in java

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are planning to start a new Java project which is based on REST services.

My questions is,

  Whether we should use REST frameworks like jersey, RESTEasy
   OR
   Design our own using pure Java servlet

If we choose a framework we get lots of stuff out of the box like get POJO from REST ,serialization and deserialization etc.

But these frame works are using Java reflection to a large extent right? Will this cause any performance issues when the project becomes bigger and when lots of hit goes to the server?

I did go through some websites which has Web Framework Benchmarks done and in which you will see Spring framework result is too low when compared to Servlet . Check the followings links https://www.infoq.com/news/2014/05/benchmark-web-framework and https://www.infoq.com/news/2014/05/benchmark-web-framework


The basics of REST API is, all request received in a common gateway , read this request and map it to a Java class. This we can do using pure Java servlet with the help of some custom Interface. So we can avoid boilerplate code and reflection right?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use a framework, don't invent your own based on pure servlets.

Don't worry about performance problems because some frameworks might use reflection. You don't know if they are using reflection (or did you look in the source code of those frameworks?). Also, even if those frameworks really were using reflection - reflection is not so awfully slow that you need to avoid it at all cost. There is no reason to worry about performance based on vague worries about reflection beforehand.

These are well-known frameworks that are used by lots of businesses. These frameworks have proven themselves already.

Creating REST webservices based on pure servlets is much more work and much harder to get right than using a framework which already puts the basics in place for you.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vs, and welcome to JavaRanch,

First: Don't use too much bolding in your posts. It comes across as shouting!!! - and I'm sure you didn't intend that.

Vs Prasanth wrote:But these frame works are using Java reflection to a large extent right?


No idea; but I suspect they may use some.

Will this cause any performance issues when the project becomes bigger and when lots of hit goes to the server?


Not your problem - And the reason I put that in bold is because it's very important.

You are presumably using (or buying) this framework precisely because you don't have to write the code yourself.
And if you bought it, you presumably also have an SLA that covers concerns like this.
If not, and you're worried about it, the best people to address this question to is the authors.

However, in general, and assuming the product is good, you can usually trust them to make sure that their software scales well - especially with something like REST -  otherwise they'd be out of business pretty darn quickly.

So my advice:
1. Don't go looking for problems before they occur ... especially when it comes to optimization/efficiency.
2. As Jesper said: DON'T re-invent the wheel - especially as an "end-around" to a problem that you don't even know exists.

You bought/adopted the product for a reason. Use it the way the authors tell you to.

HIH

Winston
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic