Similar to How to have 2 JVMs talk to one another, but with the added requirement that there be per-user authentication between the 2 JVMs. I have one Windows machine that multiple users will utilize, each using 2 java applications (essentially a client process and server process). The communication should be isolated, such that no user can see or access the data moving between another user's client/server.
I'm looking at named pipes and Netty as of now, but not sure of how each supports the above requirement, or which is more reliable / easier to set up.
Related
Using Tomcat or JBoss, how do I transfer and save dynamic image content from an image repository on one server to a number of other servers (machines) on the same network without writing a Client/Server application?
The web site I am building contains a large number of images that will only be saved and shared on one machine. All of the web app servers need to be able to access these files.
Kermit Love, here are a few suggestions based on your requirements. Note that none of these are based on Java nor specific to Tomcat / JBoss.
Option 1 : Using a NAS or a Shared Directory
Using a specific hardware (NAS), a file server (Samba) or a simple shared directory over the network would allow all you machines to access the content through the network.
Pros:
This solution can scale
Setup is easy
Cons:
The network overhead may slow down your global solution depending on your needs (access frequency, images sizes, ...)
No high-availability (fault tolerance)
Option 2 : Using an upfront server dedicated to load balancing / reverse-proxy / serving files
You can use a simple Nginx / Apache server to deliver "static" content while routing trafic to your application servers.
Pros:
Efficient way to serve images to clients.
You separate the concerns (business logic vs serving files).
Cons: No high-availability (fault tolerance)
Option 3 : Using rsync to synchronise file systems
You can define a cron based rule to run a rsync command every N seconds/minutes to ensure all your machines have the data available.
Pros:
Easy to setup
Free (no need extra hardware, for now)
(slightly) better performance in the long term than option 1 (no repeated network overhead).
Cons:
Yet an extra-process
Doesn't scale horizontally
Files won't be immediately accessible
I have the following requirements:
1. Implement the load balancing for two same processes(Mirth3.0.1) available on two different LINUX machine.
2. The two processes(Mirth) capable to receiving the requests.
3. If a process over UNIX server taking lots of CPU usage then switch to other process running on different LINUX sever.
Let me know how this can be achieved using JMX. OR let me know if this can be achieved using different programming technique.
Thanks!
You'd generally need a 3rd process that acts a "reverse proxy". All the requests go to that process and it will route the request and response to whichever server is the active one.
This 3rd process would also be looking at the machines to measure CPU (using JMX or whatever tools you'd like), and use some logic to change the active server.
I'm currently building an application that is about VOIP / random chatting, which is similar to skype or chatroullet. My question is extension to this
https://stackoverflow.com/questions/11384155/running-java-server-application-24-7-not-on-local-machine
I've been experimenting and playing around with TCP / UDP sockets and now I have ability to build VOIP / instant chatting applications. But as you might already know, in order for data transmission between client to client or client to server, the server application has to be powered on (in other word, be online) and be accessible by client applications. The problem is that, I'm not living by my self but with my family, which I can't simply use one of my computer to run my server application for 24/7 mainly due to the electricity bills and my lack of knowledge about the networking concerns me about the security, because I had to go through some configuration / port forwarding on my current router in order to make the protocol accessible by other users outside of my local network. So my biggest question is that, how do people or developers normally have been dealing with this kind of situations? Have they been simply using their own computer to run the server application? or have they purchased an external machine to run the server application
===========================================
Additional question:
Is TCP / UDP socket the only way of making applications such as MMO, VOIP and instant chatting programs?
i see that your topic was closed in the previous thread. I think such questions are unrelated to stackoverflow.
However, i would like to give you a glimpse of what is happening to most of us who own / make Java Web Applications. I used to work in a datacenter for a year and a half. Java applications are a little harder to put online as they require resources that not many data centres are willing to invest time and support in. Other than that, they are pretty much as straightforward as normal PHP applications.
You will need the standard options like Colocation, Dedicated Server, VPS, Cloud Virtual Machine, or a shared tomcat / application server hosting.
Colocation is where you put your own purchased and configured server with the data center, you have complete ownership of the server, nobody can touch it unless permitted by yourself. You pay to put your server into the data center, and are in charged of anything that happens within the server, including OS patch.
Usually servers in data centers (due to size constraint) come in rack units. 1U refers to 1 rack space, usually this is equivalent to one PC, although a server is much more powerful. In Singapore, the charges per U is SG$200.
Dedicated server is where you lease a server from the data center. The server is managed by the data center and can be as powerful as you want it to be. OS updates, installations, service guarantees are provided by the data center.
VPS is having a fraction of a server resource, but many challenge that you do not have the "root" access to the server in most cases.
Cloud is the virtualization of the entire operating system. If this was Linux, you would have the root access to it. Many of us now are going for this option because of its scalability. Some data centers may use popular virtualization hypervisors like VMware ESXi, Microsoft Hyper V.
The list above is represented from the most expensive to the least. Of course, that is depending on your location and service provider.
Hardly anybody i know tries to put a running server at home, it is a fire hazard itself, you will not know when your electricity will be cut off, standard dedicated bandwidth would as expensive.
Hosting with a data center would be much cost efficient and safer in my opinion.
EDIT:
Is TCP / UDP socket the only way of making applications such as MMO, VOIP and instant chatting programs?
Have you looked at HTML 5 Web Sockets, or any AJAX based framework for this?
Try searching the web for cloud hosting. For example, Heroku, AWS and many others provide a hosted service. That is what people use to host their service and it is more cost effective than trying to maintain something yourself.
Are you writing an Android application for it as well? Just as an aside you might want to make use of this ARO tool to ensure you are using the network efficiently. http://developer.att.com/developer/legalAgreementPage.jsp?passedItemId=9700312
I need some advice on the best way to implement a software that I need to distribute and install on both windows and linux machines.
I have written a small Java messaging application that runs locally on my machine and listens to a particular port for streaming messages. This application pushes the messages onto a JMS queue. My web application then polls the JMS queue (also local) and runs as expected.
I now wish to scale my application significantly. This means I want to be able to distribute a messaging application to other users (potentially anywhere in the world) who can install it then select a port number using a simple user interface and then run the application. This application would perform the same as the messaging application I have written in JAVA. It would process messages on the selected port and then publish them to a queue on my queue server - from which my Java Application would poll the messages.
I am wondering a couple of things...
I am a Java programmer but wonder what would be the easiest way to produce the remote client that can be easily installed on various platforms? I would rather people could download and install rather than dealing with complex platform dependencies. This might mean a Windows installer...
I was thinking of using the AMQP messaging as the backbone - such as RabbitMQ. This is especially important if I decide to shy away from distributing a Java based message application.
Just some thoughts on the approach would be appreciated.
what would be the easiest way to produce the remote client that can be easily installed on various platforms?
Pure Java, with a GUI, deployed using Java Web Start. The user clicks a link, follows the prompts, and the app. is on screen (with automatic update).
Designed by Sun (maintained by Oracle) to be used on Windows, *nix & OS X.
We currently have a centralised web app and database (running on glassfish and oracle) which is accessed from multiple stations distributed about the country.
At the stations there is data entered into and read from the system (through the browser).
When the (external) connection goes down between the station and the centralized web app we would like for the stations to continue to function - store and present data, then when the connection returns the data is pushed back into the central server maintaining database integrity.
Given that we would be willing to change our app server or database if it was worth it, how is this best handled, is there any out of the box solution for this?
Install the servers at the individual locations, replicate what you want to share across them "routinely", and leave all of the other centralized, but non-vital tasks (like, say, reporting) on the central system.
There is not "out of the box" solution. You system is centralized for whatever reason it's centralized. You're asking for it to be decentralized. By doing so you need to reconsider why it's centralized in the first place, and what dependencies there are because of that centralization (such as each site having instant access to data at all of the other sites).
Address those issues of what you can do without, for how long, and how to share it, and then you can set up autonomous sites. The magnitude and complexity of this process is dependent upon you application and the services it supplies to the remote users.
If you can tolerate losing the current sessions I would point you to look for a distributed database (replication). Oracle probably supports it. In each office you would have a glassfish server
But it is going to cost a lot:
Licences
Hardware (servers)
Properly securing the server
(Lots of) tuning/rewritting to avoid new bottlenecks
Maybe it would be easier / cheaper if you chose to just use redundant internet access for all of your offices.
If you are willing to go cutting edge, then look into HTML 5 with Local Storage. Note that the local storage specification in HTML 5 is still in transition. The second link I included has a good fallback option for when HTML 5 local storage is unavailable. With the fallback option of Store.js, you won't even need to require your clients to use a modern browser, though it definitely helps.
Another option, if you are open to moving in that direction, is to use Adobe Flex 3 for your UI, talking through LiveCycle to your application hosted on Glassfish. There will be more moving parts and a steeper learning curve though.