Solved

Which is faster - Restful Services or regular queries?

Posted on 2014-04-03
1
240 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet filter example 37 84
eclipse apache tomcat admin console 52 155
check java version using powershell 13 303
ejb stateless example 2 43
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

733 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