IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Communication between two servers.
On one end we have a Java web application (JSP) running in a J2EE container (actually, load balanced on 6 servers). On the other server we have a C++ daemon that performs calculation services. What I'm trying to do is figure out the best way to request services of the C++ daemon from the Java app.

Ideas so far:
  1. Sockets - use a simple protocol and hold a connection open to the C++ daemon on each server.

  2. HTTP requests (not my idea) - treat the C++ app as a web service

  3. JMS, with a Java or C++ JMS client on the calculation server - block each servlet thread on a response on a JMS queue



It seems to me that 1) requires more upfront work, but offers the most control. The downside is that we have to manage reconnects, failures, and so on manually. 2) has way too much overhead for each request (create/tear down a socket) but offers a nice stateless paradigm, and 3) combines the best of both, with an amount of complexity in the middle.

Any other methods I'm missing, or considerations I should be aware of?
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New SOAP
...but then that's just another layer on top of http. :-)
New Right, that's what I'm trying to avoid.
SOAP involves XML creation and parsing in addition to building up and tearing down a socket for each request. :-P

Hey, let's use UDDI too! Then we can have dynamic discovery, XML, *and* HTTP layers!

Oh, oh, oh... I know! Make the XML message include a serialized Java object! Serialization, discovery, XML, and HTTP! ;-)
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Welcome to my life
===

Implicitly condoning stupidity since 2001.
New Stupid Object Asskiss Protocol



In Java, you can't escape the creepy feeling.

     --James Gosling
New SOAP is one those decent ideas...
...that quickly got muddled - like much of XML. The MS habit of passing around stuff in binary form makes the case for readibility and loose coupling an early casualty. Might be just me, but reading SOAP calls (to & fro) gives me a headache as what is supposed to be a fairly straightforward arrangement gets really muddled in the details.

As long as we're at it, why not Java RMI? Guess that's implicit within the suggestion of JNI?
New A decent idea?
One of the key arguments for SOAP from the start was as a way to get around those pesky firewalls. They also admitted that security was something that SOAP did not address.

Technologies which are meant to get around security solutions while not addressing security problems do not qualify as decent ideas in my book. Companies (like Microsoft) which have a history of pushing these qualify as problems.

Cheers,
Ben
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New Valid complaint
But you still have problems with authentication if you roll your own socket scheme. And authentication is not part of JMS, though the vendors implement their own in the connection.
New In fairness,
authentication and encription is supposed to be provided by the underlying layer, HTTP. MS uses SSL for encription and NT proprietary crap for authentication, HTTP's own being to weak.
--

OK, George W. is deceptive to be sure. Dissembling, too. And let's not forget deceitful. He is lacking veracity and frankness, and void of sooth, though seemingly sincere in his proclivity for pretense. But he did not lie.
[link|http://www.jointhebushwhackers.com/not_a_liar.cfm|Brian Wimer]
New No, she's a dog
Actually, watching the webservices crowd define their stuff is like reliving the CORBA stuff. Next we'll need authentication, then transactions....

Mind you - I invented SOAP messaging with attachements (later polished up and claimed by MS) to solve problems with document processing submissions while at eTranslate. I still think the attachment solution was good, but the SOAP format itself is ridiculous overkill. Plus the crowd that was early adopters were every bit as pig headed as a C++ elitist in the early 90's.



In Java, you can't escape the creepy feeling.

     --James Gosling
New Quick alphabet soup translation:
JMS? whazzat?
jb4
"There are two ways for you to have lower Prescription-drug costs. One is you could hire Rush Limbaugh's housekeeper ... or you can elect me President."
John Kerry
New Java Messaging Service
Like MQSeries. Point-to-point and publish-and-subscribe messaging.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Danke
jb4
"There are two ways for you to have lower Prescription-drug costs. One is you could hire Rush Limbaugh's housekeeper ... or you can elect me President."
John Kerry
New roll own xinted service?
Issues of authentication are then handled at a higher level.
-drl
New Just remember--anything manual can be automated
If that's the only con to sockets (and I'm inclined that way), sounds like a winnah.
New Well, that's what I meant.
As is, we will have to write the code that manages the state of the socket connection.

I think there's a little bit of "web services are cool, let's use those" going on here as well... personally I don't see any advantages if you are in control of both endpoints of the connection.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New I lean towards sockets as well
I haven't tried JMS but socket programming in Java is pretty straightforward.
Tom Sinclair

"Man, I love it when the complete absence of a plan comes together."
- [link|http://radio.weblogs.com/0104634/|Ernie the Attorney]
New Remember there's C++ on the other end.
One of the (muddled, 2nd hand) reasons for the HTTP transport was a desire to have the threads managed for us.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Name one:
Webserver that manages Threads nicely...

Solaris with Weblogic and/or Apache2 (and recent versions only) are about the only ones I can think of that work well in that respect. But given most things are not thread safe right now...

IIS claims Full threading support... but only if everything is being done with the webserver machine. Apache2 does do threading, but so many thing these days are NOT multi-thread safe *YET*. Prolly won't be for a few years yet.

Weblogic... well if you dare delv into that one... go for it.
--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey

Multi-Finethreaded Tagline
.......................
...............
.....
...........................
New I'm guessing the answer will be:
IIS. Based on from whom the suggestion is coming.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New 4. CORBA connection but same objection as JMS Go with socket
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New My Gut reaction tells me:
Even though I am on drugs right now.

Sockets are the best way to go, faster, more direct and since you would be controlling both endpoints, there is literally little if any problem.

Xinetd is a fine example of this mentality... except you want to re-think the data handling as it does have some restrictions of throughput.

Matter of fact you could probably look at the xinetd source and get some ideas on how to handle them.
--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey
New We have plenty of socket servers here already.
I'm looking more for reasons not to do HTTP as well, I guess.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Sockets can stream, http does not, its connectionless
so overhead will be higher using http and streams are faster.
thanx,
bill
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New HTTP 1.1 supports pipelining, FYI.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New YALOP
Yet Another Layer of Processing.

Okay...

You could have http read the socket and send over the data over http.

But why, why would you add another layer of processing. http has to be generated... gads adds tremendous complexity without any benefit of making things more robust.

Complexity is nice, but only to a point. Me personally http was designed for one thing: a presentation transfer layer, it has lots of overhead and rides on top of TCP/IP. I akin this to electroncis... a transformer to be exact.

A transformer is used to "isolate" or to multiply or divide (Voltage or Current). Theoretically they are supposed to be 100% efficient. In the real world, they can be as good as 98% but as bad as 50%. IOW, you lose much power just by adding a layer. The part that applies here is the Isolation.

Or think of it as someone "expanding" your data, so it can travel over http. The only real help would be using an http server that compresses on the fly... of course a socket server can do that too, easier too as it doesn't have constraints placed on it by another process or service.

"More work up front" usually mean "A lot less work down the road" which is usually a ++... to the good. http (specifically IIS) is a seriously moving target... if you can STOP any changes from happening... you could go that route but even Apache (or Weblogic, or WebSphere, or Roxen etc..)are still moving the specs around and break things from time to time.

--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey

No, not here, not this time...
New Agreed
The rexec (rsh, rlogin...) code should provide a speedy framework for setting up as complex a c/s system as you want.

If all that is needed is to pull results from a calculation, you could just use r-commands in the first place.
-drl
New Why not HTTP?
I'm looking more for reasons not to do HTTP as well, I guess.

What is wrong with HTTP? Anything else and you risk fire-wall problems. Server admins don't like special requests for "odd ports" at many companies. Simply use POST to send XML or comma-delimited text.
________________
oop.ismad.com
New Read the problem description.
No firewalls are involved. While you are correct that firewalls preclude anything other than HTTP for the most part, this is entirely internal on our LAN.

If you want to have real fun, try building a bi-directional persistent comm link between a client browser and an internal server through a firewall, when the internal server is actually a load-balanced non-clustered web farm. ;-)
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New You didn't qualify "too much overhead"
Nothing is going to be an exact match to your desired performance or interface requirements.

If you are sending streams of a gazillion little transactions, can some of them be grouped together so that packet overhead is less? Or, does each one need a reply before the next one is sent?

These details are left out.
________________
oop.ismad.com
New Packet overhead doesn't matter.
Computational overhead does matter.

The transactions are uncoupled.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New DECNet Mailboxes.
Wha? You're not using VMS?

Idiots, the lot of you.


Peter
[link|http://www.debian.org|Shill For Hire]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Blog]
New AHHH! NO!!!
I had to Y2K-fix a system that was essentially a DECNet roll-your-own C/S system, written in - no kidding - DEC BASIC. AAAHHHH! AAAAHHHHHHH!
-drl
New Silence, heretic.
The guards will be with you presently. Your stake is ready.


Peter
[link|http://www.debian.org|Shill For Hire]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Blog]
New Socket to me
Does the C++ thing need to be a daemon? Why? Is there something in the C++ thing that shares data or can you have one instance per invocation? Would melding it into the appserver via JNI be evil?

>Sockets - use a simple protocol and hold a connection open to the C++ daemon on each server.

Nice, simple. You'll want to pool the connections of course.

>HTTP requests (not my idea) - treat the C++ app as a web service

Sockets with crap in front. I don't see the advantage. Plus, if the C++ code is memory resident and stateful (why else is it a daemon?), you still have to deal with the same threading issues with the sockets.

>JMS, with a Java or C++ JMS client on the calculation server - block each servlet thread on a response on a JMS queue

If you need synchronous responses, then this is a waste of machinery I think. Although its probably less crappy than HTTP. Not sure about the quality of C++ JMS client code available.

Given your org's experience with sockets already - I'd go with those as they are "The Simplest Thing That Could Possibly Work (TM)"



In Java, you can't escape the creepy feeling.

     --James Gosling
New Why the daemon:
The code needs to be very, very fast, and the trade-off is memory for speed. The daemon can take up to 10 minutes to load all of the data necessary to make the calculations. The datafeed is very high volume and the calculations are non-trivial. One of those few applications that really *does* need to be extremely efficient.

I'm supposing here, but I think the HTTP connection really means "OCX/ActiveX/whateverXitistoday used as a web service in IIS and .NET". I don't have all the details, however; the information was second hand. This is just a suspicion. Many of the same disadvantages apply if it's "C++ through JNI in a Java web service".

WRT your question about JNI, that was one of the alternatives I had thought of. If we're wrapping the C++ stuff in a framework, why not use a Java appserver as the framework so it can run on more than just Windows.

WRT synchronous responses and JMS, one advantage is that one or both ends can go down and the messages are saved. We get that for free.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Not an answer then, but a plan of attack :)
Taking up the mantra: "design first, then optimize"

1.
I'm supposing here, but I think the HTTP connection really means "OCX/ActiveX/whateverXitistoday used as a web service in IIS and .NET".
Get them to spell this out in a design meeting.

2. Suggest that this decision be left for later, when several competing strategies can be tested. Abstract the communication process.

3. When it comes time to finalize the comms, remind them:
The code needs to be very, very fast, and the trade-off is memory for speed...One of those few applications that really *does* need to be extremely efficient.


4. Show the native socket app blowing .NET out of the water.

5. Reintegrate the abstracted comms code for a final speed improvement.

Ooh, I can work this Team Thinking, can't I? >:)
"There's a set of rules that anything that was in the world when you were born is normal and natural. Anything invented between when you were 15 and 35 is new and revolutionary and exciting, and you'll probably get a career in it. Anything invented after you're 35 is against the natural order of things."

Douglas Adams
New Complicated political situation.
That might work, given different personalities. :-)
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New You mean you're not king?
Dude, just lay down the law. Surely the other hacks will bow down before the admin-guy?



In Java, you can't escape the creepy feeling.

     --James Gosling
New Tuxedo/Java Jolt?
If you have the money, you might look at Tuxedo and Java Jolt.

Tuxedo allows you to provide C++ code in the form of services, and Jolt allows you to create your Tuxedo output as a Java class, instead of having to parse through a buffer.

Again, it will cost some money, but it performs well, and it's tried and true reliable.
Expand Edited by gdaustin Oct. 20, 2003, 03:11:19 PM EDT
     Communication between two servers. - (admin) - (39)
         SOAP - (ChrisR) - (8)
             Right, that's what I'm trying to avoid. - (admin) - (1)
                 Welcome to my life -NT - (drewk)
             Stupid Object Asskiss Protocol -NT - (tuberculosis) - (5)
                 SOAP is one those decent ideas... - (ChrisR) - (4)
                     A decent idea? - (ben_tilly) - (2)
                         Valid complaint - (ChrisR)
                         In fairness, - (Arkadiy)
                     No, she's a dog - (tuberculosis)
         Quick alphabet soup translation: - (jb4) - (2)
             Java Messaging Service - (admin) - (1)
                 Danke -NT - (jb4)
         roll own xinted service? - (deSitter)
         Just remember--anything manual can be automated - (FuManChu) - (5)
             Well, that's what I meant. - (admin)
             I lean towards sockets as well - (tjsinclair) - (3)
                 Remember there's C++ on the other end. - (admin) - (2)
                     Name one: - (folkert) - (1)
                         I'm guessing the answer will be: - (admin)
         4. CORBA connection but same objection as JMS Go with socket -NT - (boxley)
         My Gut reaction tells me: - (folkert) - (9)
             We have plenty of socket servers here already. - (admin) - (8)
                 Sockets can stream, http does not, its connectionless - (boxley) - (1)
                     HTTP 1.1 supports pipelining, FYI. -NT - (admin)
                 YALOP - (folkert) - (1)
                     Agreed - (deSitter)
                 Why not HTTP? - (tablizer) - (3)
                     Read the problem description. - (admin) - (2)
                         You didn't qualify "too much overhead" - (tablizer) - (1)
                             Packet overhead doesn't matter. - (admin)
         DECNet Mailboxes. - (pwhysall) - (2)
             AHHH! NO!!! - (deSitter) - (1)
                 Silence, heretic. - (pwhysall)
         Socket to me - (tuberculosis) - (4)
             Why the daemon: - (admin) - (3)
                 Not an answer then, but a plan of attack :) - (FuManChu) - (2)
                     Complicated political situation. - (admin) - (1)
                         You mean you're not king? - (tuberculosis)
         Tuxedo/Java Jolt? - (gdaustin)

DUDE!
114 ms