On 21/07/05, srikanth peddireddy <[EMAIL PROTECTED]> wrote: > > > Hi Sebb, > > can you please answer some more questions on this topic. I gave some of my > assumptions and dopubts below your response > > >>The current TCP Sampler creates a new socket for each sampler > >>occurrence in each thread. I do plan to add re-usable sockets to the > >>TCP Sampler, but that probably won't be for a few weeks. > > First I planned to extend the TCPsampler by myself and though of a design > like this : > There will be a specialized TcpSampler(for discussion lets call it > SharedTcpSampler) . Instances of this SharedTcpSampler will be used for all > the TCP requests that we want to make to a server over a single > connection/socket. > This SharedTcpSampler will have a property called "sharedSocketReference" > which will be something like a reference name that we give to a global > counter inorder to use it else where in testplan. > Each SharedTcpSampler will first try to get the socket instance by > searching for it in a Global NameSpace (Iam yet to know what this Global > Name Space would be in Jmeter context) by giving the "sharedSocketReference" > value that user will configure in testplan. > > If this search is successful,( ie some other SharedTcpSampler in the > testplan has already created a socket connection and registered it under > this name), then it will send its "Text To send" (inherited from TcpSampler) > over that socket and reads back the response. > > If this search fails , which will be the case with first SharedTcpSampler in > the testplan , it will create a new socket and register it in a Global > NameSpace under the name specified in "sharedSocketReference" and continues > using it for implmenting the protocol > > So in this solution, all the SharedTcpSamplers in a testplan with same value > given in their "sharedSocketReference" property will share a single socket > connection. Hence I think it will serve the purpose.
You need also to consider how to handle socket errors - if one sampler detects a problem, it may need to close the socket and delete the reference. And the socket ought to be closed at the end of a test run (not essential if you only run a test once and then exit JMeter). > > But I know that inorder to implement this I need to know the architecture of > Jmeter and different components of it in detail. I was unable to study this > any further as I was tied to some other work. :-( > Sebb, can you please tell me whether this design fits the bill. If yes > please direct me towards some resources thru which I can quickly learn about > architecture and components of Jemter and implement this. > Iam planning to do this as soon as possible. :-) See above > > >>One way to re-use the same socket might to have only a single sampler, > >>and vary the content of the request using a function call to read it > >>from a file. > > can you elAborate on this or tell me about the resources where I can find > details. Read the Manual (Functions), JMeter FAQ and the extending JMeter documents in the xdocs/extending directory in CVS. > >>However, I've not tried this. > > > == > > >>Note that the TCPSampler class is the one that creates the socket. The > >>TCPClientImpl class uses the socket to implement the protocol. > > >>The current protocol sends the string as is, and reads bytes until the > >>EOL byte is seen. EOL can be defined by the property tcp.eolByte. > > In my application all server responses end with a "5". > We achive this by appending (char)5 at the end to the String to be sent . > > like String txtTosend = "some data "+(char)5 > > stream.write(txtTosend.getBytes()); > > > So now can I give 5 for tcp.eolByte so that Jmeter reads entire response > string/data ??? So long as "5" does not appear anywhere else in the data, yes. Otherwise you'll need to create your own TCPClientImpl class. > > == > > >>JMeter is built around the assumption of a request/response sample. > > >>There's currently no provision for reading from a socket without > >>previously writing to it, but that would be trivial to add - I may > >>well add that to the nightly code shortly. Or indeed it may already > >>work if you provide an empty string. > > >>But the test plan would have to include samplers for each expected > >>server response. > > >>If a single client request results in a known number of responses, or > >>there is some other way of telling that the server has finished > >>responding to the original request, then the TCPClientImpl read() > >>method could implement this. > > can you eloborate on this or tell me about the resources where I can find > details. > S. See above. Also have a look at the source for the classes I mentioned. > > > > > Regards > > Srikanth.P > > Disclaimer > ------------------------------------------------------------------------------------ > This e-mail message may contain confidential, proprietary > or legally privileged information. It should not be used by > anyone who is not the original intended recipient. If you > have erroneously received this message, please delete it > immediately and notify the sender. > > The views, opinions, conclusions and other information > expressed in this electronic mail are those of the > individual sender and not endorsed by SDG Software > Technologies Pvt. Ltd. unless otherwise indicated by an > authorised representative independent of this message. > > Before opening any attachment please check them for viruses > and defects. SDG Software Technologies Pvt. Ltd. shall not > accept responsibility for any loss or damage arising from > the use of this email or attachment(s). > ------------------------------------------------------------------------------------- > > ________________________________ > How much free photo storage do you get? Store your friends n family photos > for FREE with Yahoo! Photos. > http://in.photos.yahoo.com ________________________________ > How much free photo storage do you get? Store your friends n family photos > for FREE with Yahoo! Photos. > http://in.photos.yahoo.com > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

