Solved

Which is faster - Restful Services or regular queries?

Posted on 2014-04-03
1
229 Views
Last Modified: 2014-04-12
Which scenario is faster?

Java (fx) front end communicating with a Derby database on a Glassfish server by
doing regular database queries (i.e. SELECT * FROM TABLE...)

or

Java (fx) front end communicating with a Derby database on a Glassfish server by
way of Restful Services / Servlets?

(Glassfish server is not local)
(database contains info such as names  and numbers)
0
Comment
Question by:pdering
1 Comment
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
Comment Utility
There's not really enough information to say definitively, but more than likely the first alternative (direct database queries) is probably faster. I say this because in the second alternative, you still need to query the database, but you are just adding another layer to the process, ie. the REST service layer. However, the difference is probably so small that other factors would probably outweigh these, ie. the fact that your servlet could "hide" the implementation details of the database, and/or include common business logic for managing the data in the database in the one single place.

Where the situation might be reversed though (so that the second alternative might be faster), is dependant on exactly what you might be doing with the data. For example, say you are retrieving a substantial amount of data from the database and then operating on that data. In the first situation, you need to move all that data across the network from the database to the front end and so THIS may be the bottleneck, where as in the second alternative, the data is retrieved locally and THEN operated on before sending (via REST) just the small result of those operation to the front end.

So, as you can see, a definitive answer to your question would depend on a lot of factors!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now