What are modern approaches for Reliable multicasting in Java world?
Searching the Web, I've came up with JGroups and JRMS. JGroups seem to be an overkill in my situation (I want to have a set of identical nodes which cooperate together and make them able to join this group by notifying every existing node). JRMS looks like being already dead.
I was unable to find any particular implementation of PGM protocol for Java.
Have a look a jmdns which implements Zeroconf (Apple Bonjour) in pure Java.
Very useful if you just want to know who else is out there, and let them know about you.
http://jmdns.sourceforge.net/
Hazelcast says it supports messaging, amongst other things (distributed maps etc)
https://hazelcast.org/
It is used as library in other distributed Java applications such as OrientDB, Apache Camel, and has plugins for Java Application Servers, such as Tomcat Session Replication.
Related
I am attempting to create a program that can manage EC2 instances (create, stop, terminate). I am unfamiliar with the service, and after looking through documentation and searching the web have not found any general advice on creating a management service. My questions are:
What programming environment/language would best be suited to creating a management program?
How can this program interact with EC2 instances? (I've looked into AWS EC2 command line tools. Can these be used from a program to create/terminate instances?)
Any general advice in accomplishing this is appreciated (links to examples especially).
What programming environment/language would best be suited to creating a management program?
This question cannot be answered in a definite way, rather you should either choose the language you are most comfortable with or that's best suited to your environment/team instead - there are plenty to choose from, most popular major languages are covered by a dedicated SDK (currently Java, .NET, Node.js, Python, PHP, Ruby), see Tools for Amazon Web Services for the detailed listing and links to further information about each.
Please note that there are also two IDE Toolkits listed that might make it easier to get started if you happen to develop in Java or C#, specifically the AWS Toolkit for Eclipse and the AWS Toolkit for Microsoft Visual Studio.
How can this program interact with EC2 instances?
All the SDKs (and also the command line tools build on top of these) do use the AWS APIs to interact with the respective services (each one has a separate API, but most of them are structured very similar), see Documentation for a listing of all currently available services and links to their documentation:
Welcome to the Amazon Web Services (AWS) Documentation. Whether you are new to AWS or an advanced user, you can find useful information about the services ranging from introductions to advanced features.
To learn how you can get started with AWS, see our Getting Started with AWS guide. If you are interested in learning more about our AWS Free Usage Tier, see our AWS free usage tier article.
I guess you are new to the cloud and aws world, you can use AWS Command line tools to management the services. Also to make things pretty simpler you can make use of the readily available aws management console if you are only worry is to start, stop or terminate the instance. Also people have build some thing called Config management system like opscode chef which is built of ruby or you can use puppet built of puppet lab's custom DSL.
I am not sure if you really need a program to do that. The Amazon Management Console ( https://console.aws.amazon.com ) is pretty straight forward, simple to use, you can spin thousands of instances in a very short time. I created 20 instances in about 3 minutes and deleted(terminated) 9 during my first interaction with the technology. Would you provide a use case where this is necessary? Its like you want to create a missile to kill a chicken(rather than buy a knife)
HTH, Thanks,
Bles
I used to work on a project that deals a lot with EC2 and one of my responsibility was to manage instances remotly( deploy/start/stor/reboot). I used Java and the Amazon API to write a communication module for the application.
In addition I made a few general ant scripts to deal with code that has to be deploed into an instance. Kind a old fashion way, but works perfectly :)
I'm debating whether I should use java RMI or standard Java networking for an application i'm working on.
The app will be a networked system that has heartbeat sensors and failsafe-features. So it's a 3-tiered system, with at least a DB and java application.
So if my Database fails on one machine, I'd like the 2nd machine to "sense" this.
I'm a bit confused about Java RMI, whether it's worth it to learn it.
Or if I use standard Java networking , I can do the same as RMI? I mean, if I really know the Java networking well.
Thanks!
These days it is pretty easy to set up web services using SOAP or REST. With REST you can use XML or JSON messages without really having to know all about it. All these types of services can be accessed from .NET code or PHP or Javascript. (Well ... SOAP is sort of a pain except in .NET and Java. //personal opinion )
Spring can help you set up a service and a client interface to it is pretty easy. Fairly close to standard Annotations on bean classes and business methods define the interfaces and Spring does the heavy lifting. (I'm talking about Spring Web Services and not the Spring Remoting, though that would work as well. Spring Remoting isn't much better than RMI IMHO.)
You can also use Jersey (JAX-WS) or Jackson (Parse JSON) to do the remoting. Standard Annotations on bean classes and what-not build the interfaces. CXF will do JAX-WS and JAX-RS as well. Those are Java standards for building services and clients that communicate via remote messages.
Alternatively there are eclipse tools for generating both sides of the remote interface. All are tied to some framework (Axis-2 or CXS are some). Its sort of a code generation thing.
You might want to look into these a bit and see which one resonates with the way you look at things.
I know that I prefer all of these over using RMI. But I haven't used RMI directly in a long time.
RMI is higher level protocol compared to the bare TCP/IP support in Java via Socket class that you seem to refer to as "Java networking". If the only thing your system does is sending heartbeats and there are just few nodes you should choose RMI for simplicity reasons. As all of the participants are JVMs there is no need for any interop and extra libraries to support that and as the number of participants is limited there is no need to consider anything fancy.
I am planning to do a simple Remote Procedure Call (RPM) over the web and I am currently using WebSockets. I was wondering if Jini is better than WebSockets or if there is a newer API or framework for Java to do RPC.
WebSockets and Jini are the main ones of note, both have their pluses and minuses. I'd say WebSockets is great just for the sheer amount of examples and documentation lying about. Jini is a lot different than WebSockets - so if anything the overheard of learning how to use it may not be worth it; that is up to you to evaluate, I spose.
I wouldn't use WebSockets directly because older browsers and/or corporate firewalls may have issues with it. SocksJS
is a respected wrapper that will gracefully degrade to another transport mechanism if required while still allowing you to work with a WebSockets type of API.
The client side is generally written in JavaScript but they have a number of servers written including two in Java: Vert.x and Netty. It looks like the Vert.x implementation is a little more mature at this point in time.
How can we achieve JVM clustering in standalone Java apps? Is this a possiblity:
We create a JMS queue and deploy it on a server. Now we make all the Java apps connect remotely using weblogic jndi parameters to that queue. When a message is delivered to a queue, only one of the java apps (jms clients) will receive the message because of the very nature of a queue(as opposed to topic). Thus, load balancing a.k.a clustering can be achieved.
Is this a viable way of approaching the solution?
That approach sounds viable, and it does give you simple load balancing.
Nobody can say whether it is the best approach because you've given almost no details of what you are trying to do.
(I would not have said that "load balancing" and "clustering" are the same thing though. You can do load balancing using cluster computing, but there are other ways to do this and there are other uses for cluster computing. Refer to the linked articles for details.)
I want to develop clustering and load balancing by using Java EE, I want to use two Tomcats in back-end,If any request arrives to my application it should send request to the tomcats based on the load factor.I want to add fail over and session replication to my application. Please suggest..
The API for load balncing and clustering that i have to use and where it should be down loaded from?
What are the books that i can make reference to make my application programming?
Is Apache web server is useful to my application or not?
what are the sites that i have to use for developing my application?
The API for load balancing and clustering that I have to use and where it should be down loaded from?
Clustering is actually part of the Java EE specification and containers should thus offer support for this (understand here: clustering shouldn't involve programming on your side, you just have to follow some rules when developing your Java EE applications).
In the case of Tomcat, have a look at Tomcat's Load Balancer HOW-TO and more precisely the Tomcat Connectors documentation to implement for software load balancing. Note that many companies prefer and use hardware load-balancing solutions (with products like F5 BIG-IP or Nortel Alteon). This will be a bit more expensive though.
For the load-balancing algorithm, simple round-robin is usually used (this would be my recommendation).
For the session fail-over part, you'll need to use a Persistent Manager, very likely the JDBC Based Store implementation. Just don't forget to make the objects you'll put in session Serializable.
What are the books that I can make reference to make my application programming?
Not sure what you mean by application programming but the simple fact that you are asking this question makes me think that you shouldn't implement your own solution but rather use an existing one (software or hardware).
Is Apache web server is useful to my application or not?
For software load-balancing, Apache (+ mod_jk) would be my choice for the web server. Refer to the Tomcat Connectors documentation previously mentioned.
What are the sites that I have to use for developing my application
Again, I'm not sure what you mean by "developing my application" but the links provided so far are good starting point IMO. If you want to go a bit further, maybe check Under the Hood of J2EE Clustering (this is still a good article, even if not really new). For a more specific answer, ask a more specific question :)
I believe Tomcat and Apache already have this capability:
http://tomcat.apache.org/tomcat-5.5-doc/cluster-howto.html
The API for load balancing and clustering that I have to use and where it should be down loaded from? In my experience, load balancing is best done using hardware like F5 or Cisco ACE routers, not in software.
What are the books that I can make reference to make my application programming? See answer to 1.
Is Apache web server is useful to my application or not? Yes, it's common to put a web server in a DMZ and let it proxy requests into the app server inside the second firewall.
What are the sites that I have to use for developing my application? Can't tell based on the info you provided. It's probably not possible to get an answer to such a broad question here.
There is a good product (open source) called Terracota wich allows you clustering and balance.
http://www.terracotta.org/
For download:
http://www.terracotta.org/dl/