Solved

Which is faster - Restful Services or regular queries?

Posted on 2014-04-03
1
235 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
ID: 39976961
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 88
Where to store the queries for modification of table 4 62
oracle 11g 23 80
sql import cannot be resolved jsp 3 20
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

770 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