27.06.07 в 22:03 Jerome Louvel в своём письме писал(а):


Hi Evgeny,

The Client instance are already thread-safe and reusable, no need to
recreate them or to pool them! Inside a Restlet Application, the best is to leverage the Context.dispatcher mechanism which allows the sharing of client
connectors between several applications.

Best regards,
Jerome

-----Message d'origine-----
De : news [mailto:[EMAIL PROTECTED] De la part de Evgeny Shepelyuk
Envoyé : mercredi 27 juin 2007 14:19
À : [email protected]
Objet : client perfomance question

        Hello!
In my application i'm actively using restlet clients for
communicating
with my service(also restlet-based).
So does it make sense to pool client instances and not create
them on any
request.

--
Best Regards
Evgeny K. Shepelyuk



        Hello Jerome.
Maybe i will try to describe my situation more detailly to explain what issues i'm facing.

I have restlet-based serivce that exposes some XML documents.
It's perfomance is tested with ab and satisfies my needs :)

At client side i have some JSP that are using my service. In JSP code i'm writing smth like.

Client client = new Client(Protocol.HTTP);
client.getContext()
Response resp = client.get(......);

XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(resp.getEntity().getStream(), "UTF-8");
        
And as a result i'm having huge delays for getting the XML text. I've
discovered it with tests that measures delays of ccertain operation.
My client uses java.net.HttpURLConnection-based connector class.

Then i decided to try use simple URLConnection approach.

URLConnection con = new URL(....).openConnection();
((HttpURLConnection)con).setRequestMethod("GET");
con.setDoOutput(true);

XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(con.getInputStream(), "UTF-8");

And according to timing delays for getting XML reduced 4-5 times.
So i'm not thinking that restlet client is workign so slow and wanted someone
to advice if i'm usign Client instances incorrectly.

Thnx.
--
Best Regards
Evgeny K. Shepelyuk

Reply via email to