Solved

Which is faster - Restful Services or regular queries?

Posted on 2014-04-03
1
238 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

839 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