As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What are the main differences between CGI and Java servlets?
Servlets are run in one process (HTTP server with additional features, which called Servlet Container) and they exist as long as that process exists.
CGI means every time there's client request, HTTP server creates new instance of process to serve this request. This is performance killer. Additionally, since there's new process per each request, it means CGI can't aggregate data from several requests in memory, as Servlets can, and must resort to external persistent storage (file or DB). This is performance killer as well.
Biggest difference is that CGI died a decade+ ago.
Servlets are a standard, Java CGI never really was.
Java servlets run in some kind of container (Tomcat, JBoss, Glassfish, Jetty etc) which needs to be running to serve request.
CGI normally spawns a new process for each request which (considering starting a JVM is somewhat expensive) is not the best solution for Java.
At a minimum, using Java servlets in a servlet container should provide better performance. Using any type of CGI with Java is most likely having to spawn new Java processes for each request, which is less than ideal. In working with Java on the server-side from the web, using Servlets is really the best approach.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Googling this question returns lots of results with marketing jargon.
What I am looking for is a summary of what it does, more along these lines What is Maven?
This is the closest I could get.
"WebSphere" in the most abstract sense is a brand encompassing various products, so "a brand" is about as good an answer as you can get.
What one usually refers to when saying "WebSphere", though, is the WebSphere Application Server, which (as the name implies) is an application server - something that runs EJBs and other server-side Java technologies like servlets, JMS, etc. An example of another important player in this space is JBoss AS.
Finally, another possible definition of "WebSphere" is "its creator's biggest technology mistake" ;)
Unlike a regular web server which simply provides clients acces to html-documents, which their browser then displays as websites, an application server allows for programms/scripts to be invoked by requesting websites, which dynamically generate the websites.
In this case the scripts are written in Java. This allows for a lot of the apis provieded in Java to be utilised by your web-application (the website itself is simply the frontend of your webapplication)
So web sphere is an application server from IBM. Simple as that. This tells you what it can do.
Hope that helps.
WebSphere is an application server which supports a lot of advanced functions including load balancing, database connection managing, advanced logging options and many more.
On the other hand it introduces severe overhead, is difficult to administrate and one has to learn a lot to use it effectively. And more often than on other servers you find yourself in JAR hell. Been there.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Good day. I'm developing a website with the database which is going to be hosted in the cloud using Spring/Hibernate bundle. I also need to develop a desktop application that would be able to manage the remote database. I'm stuck choosing the appropriate method of implementing remote access. JAX-WS, RMI, Spring HttpInvoker or any other method? Which should I choose and why?
I'd choose JAX-WS/SOAP for this particular task.
Unlike binary protocols such as RMI, it goes easily over corporate proxies and firewalls. It has security mechanisms (WS-Security), transaction and session support which I believe is important for database remote management.
It also has better tooling/IDE support than any other remote access method/API/framework.
Create a service layer above dao layer and make it WS. Call WS from your web application and desktop application for using your db actions.
Despite valuable answers of my predecessors, I would like you to analyze how complex system you are bulding and how many environmentally different clients such system would have. I mean, if there would be other applications, written in different technologies than Java involved in it. If it is so, the best solution is JAX-WS. Web services are standarized and can be used among various evironments, not only Java EE. But if you are going to build some very specific system used only by your applications, RMI should be enough.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to consume a JSON-formatted data stream via WebSocket, and send the data as is to a Redis server. That's all this application needs to do; no UI, no requests need to be attended and the data doesn't need to be processed at all.
I want to get the smallest footprint and highest performance. Do you think Node.js/V8 would handle this scenario better than the Java/JVM? I'm between these 2 options because are the ones I can manage, although my main skill is Java.
It all depends on the environment that you're installing the application on, and how much experience you have with each.
Nodes event-loop based model is very efficient, however I have found Java to perform better for CPU intensive tasks. I don't consider myself to be an expert on either (approx 10 months Node.js, 3 years part-time Java experience) so don't take my answer as gospel.
In your case you're only really performing I/O which is where Node.js excells, if you're good with JavaScript pick Node!
Node.js and socket.io is easy to setup and deploy in this case. Way easy to deploy. You will be ~20-30mb ram on memory usage problem with metrix on performance here is hard because its hard to benchmark websockets. If its gone not be deployed on heroku then i would go for node.js
You can use node.js + socket.io or node.js / ruby + faye.
With traffic generating < 8k requests / sec it should be fine on both of them with very basic VPS / hardware setup.
I used faye on ruby with 1.1k clients chat over web sockets with 0 problems. And we had peak 4k clients on node.js chat. Very basic hardware.
I would suggest Node.js if you have enough experience with it.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want to code a server daemon application that provides some backend functionality. I'd like to stick to Java since I'm pretty familiar with this language and I figure it'd be much easier to just dig into a new framework and not a new language in parallel.
So far I found many promising frameworks, but all of them resemble somehow a webserver. Thing is, I don't want to code a web-application in terms of web-sites so I doubt that I'll need all the webserver-functionality such as templates and this stuff.
What would be a good suggestion for this purpose or would using a regular web-framework such as "play" without the template-stuff be the best choice?
JAX-WS is a standard for creating SOAP web services. Wikipedia link to see what it is about.
For RESTful you would need to make http requests, usually get and post and this type of service works best if you develop a website. From what I understand you don't want this, but still if ever just check the spring framework.
Raw TCP/IP is so much harder and unless you know exactly what you want (performance and optimization wise) you`re better off using a framework.
A webserver is used to implement webservices. A webserver may serve more than html to clients.
I have a personal "stack" using for a long time that is Jetty + RESTEasy and it serves no html at all (only XML and Json).
Javascript + Rest (Glassfish + Jersey for rest). Glassfish – Java EE Full profile certified reference application server (server will used for REST host).
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Actually I want to develop a simple servlet container like tomcat. It's purely my learning purpose. It would be very helpful if anyone can help and guide me where to start actually.
Thanks in advance.
First, study the Java Servlet API (fundementals) to understand to understand the lifecycle of the Servlet. Now, we're on Servlet 3 specification (The Latest Tomcat) so you will have to decide which version of Servlet API you want to implement.
Aside from studying the Servlet API you can grab tomcat's source code and read it. Start by doing something very very simple, like write a container that is capable of accepting Http request.
Start with Socket Programming. How server listen to request on port 80.
Then Start the Request Handler. How the request from the client will be treated and then send the response to the client.
Start it with single threaded environment and then go to multi-Threaded environment. To receive request from different clients.
Then you can start keeping sessions and so on...
Hope it will help you.