Reduce connections + stripping the image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Reduce connections + stripping the image

Lautaro Fernández
[hidden email]Hello,
I'm wondering if someone can give me some hints about how to prepare Swazoo just for two or maybe three connections at time. I only need so few connections because is a personal web server, with some applications around.
I also need to strip the image to get it as small as possible, anyone have done this work before? (I'm developing with VisualWorksNC 7.5)

I'll be grateful for any kind of help.

Thanks in advance,
Lautaro Fernández

--
Luke LAut SkyFernadezWalker
Reply | Threaded
Open this post in threaded view
|

Re: Reduce connections + stripping the image

Bruce Badger
I can answer this in terms of Hyper which is the branch of the Swazoo
HTTP server that we use and which is used as part of GLASS in
GemStone.

When you start the http server you give it a block (the block takes as
an argument an HTTPRequest, and is expected to return an HTTPResponse)
and can also set parameters that make the server multi or single
threading.  For example:

        HTTPServer new
                hostName: 'localhost';
                portNumber: 8080;
                multiThreading: false;
                responseBlock: [:anHttpRequest |
                                                        1 halt: 'Create a response here, e.g. ...'.
                                                        HTTPResponse notFound];
                start

Sertting >>multiThreading to false tells the server to accept only one
request at a time and wait for the block to finish handling that.  If
you make >>multiThreading true then each request forks a new Smalltalk
process.  At present there is no setting for n active connections to
clients.

Note that all our Hyper instances work with multiThreading set to
false.  This does not in any way limit the number of clients (e.g
browsers) that may connect to the HTTP server at the same time, it
just means that the specific requests are handled on a first come
first served (ha!) basis.

If you go for a multi-threaded instance you must make sure that the n
processes don't intefere with each other (e.g. by many processes
trying to modify the same object or use the same resource (e.g. a
file)).  Realy milti-threaded apps in a single memory space (e.g. a
Smalltalk image) are hard.  Avoid if possible.

Experiment with the above code fragment to see how it works in practice.

All the best,
    Bruce

2008/5/30 Lautaro Fernández <[hidden email]>:

> Hello,
> I'm wondering if someone can give me some hints about how to prepare Swazoo
> just for two or maybe three connections at time. I only need so few
> connections because is a personal web server, with some applications around.
> I also need to strip the image to get it as small as possible, anyone have
> done this work before? (I'm developing with VisualWorksNC 7.5)
>
> I'll be grateful for any kind of help.
>
> Thanks in advance,
> Lautaro Fernández
>
> --
> Luke LAut SkyFernadezWalker
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Swazoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swazoo-devel
>
>



--
Make the most of your skills - with OpenSkills
http://www.openskills.org/
Reply | Threaded
Open this post in threaded view
|

Re: Reduce connections + stripping the image

Janko Mivšek
In reply to this post by Lautaro Fernández
Hi Lautaro,

Did you already try the approach shown in tutorial?
http://www.swazoo.org/documentation.html#h-4

Swazoo is by default opening a new Smalltalk process for every HTTP
connection so that you can run respond to requests paralelly, but you
can also switch off and responds serially in one single process.

To strip parts of Swazoo to save place - I'm not sure that removing
something like most of Swazoo-Resources will help a much, because I have
a feeling that most code is in Swazoo-HTTP, Messages and Headers and you
cannot remove that.

I hope that this a bit late answers helps a bit.
Janko


Lautaro Fernández wrote:

> <mailto:[hidden email]>Hello,
> I'm wondering if someone can give me some hints about how to prepare
> Swazoo just for two or maybe three connections at time. I only need so
> few connections because is a personal web server, with some applications
> around.
> I also need to strip the image to get it as small as possible, anyone
> have done this work before? (I'm developing with VisualWorksNC 7.5)
>
> I'll be grateful for any kind of help.
>
> Thanks in advance,
> Lautaro Fernández
>
> --
> Luke LAut SkyFernadezWalker
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Swazoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swazoo-devel

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565


Reply | Threaded
Open this post in threaded view
|

Re: Reduce connections + stripping the image

Lautaro Fernández
Hi Janko,

2008/6/2 Janko Mivšek <[hidden email]>:
Hi Lautaro,

Did you already try the approach shown in tutorial?
http://www.swazoo.org/documentation.html#h-4
Yes, but I can't find in that example a way of restrict the maximum numbers of connections
 
Swazoo is by default opening a new Smalltalk process for every HTTP
connection so that you can run respond to requests paralelly, but you
can also switch off and responds serially in one single process.
This won't be a problem, because there will be just one server HTTP
 
To strip parts of Swazoo to save place - I'm not sure that removing
something like most of Swazoo-Resources will help a much, because I have
a feeling that most code is in Swazoo-HTTP, Messages and Headers and you
cannot remove that.
Thanks for the hint :^]
 
I hope that this a bit late answers helps a bit.
Janko
It helps

Thanks a lot,
Lautaro
 



Lautaro Fernández wrote:
> <mailto:[hidden email]>Hello,
> I'm wondering if someone can give me some hints about how to prepare
> Swazoo just for two or maybe three connections at time. I only need so
> few connections because is a personal web server, with some applications
> around.
> I also need to strip the image to get it as small as possible, anyone
> have done this work before? (I'm developing with VisualWorksNC 7.5)
>
> I'll be grateful for any kind of help.
>
> Thanks in advance,
> Lautaro Fernández
>
> --
> Luke LAut SkyFernadezWalker
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Swazoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swazoo-devel

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swazoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swazoo-devel



--
Luke LAut SkyFernadezWalker
Reply | Threaded
Open this post in threaded view
|

Re: Reduce connections + stripping the image

Lautaro Fernández
In reply to this post by Bruce Badger
Hi Bruce,

2008/6/2 Bruce Badger <[hidden email]>:
 
[...]
Sertting >>multiThreading to false tells the server to accept only one
request at a time and wait for the block to finish handling that.  If
you make >>multiThreading true then each request forks a new Smalltalk
process.  At present there is no setting for n active connections to
clients. 
 
Note that all our Hyper instances work with multiThreading set to
false.  This does not in any way limit the number of clients (e.g
browsers) that may connect to the HTTP server at the same time, it
just means that the specific requests are handled on a first come
first served (ha!) basis.

If you go for a multi-threaded instance you must make sure that the n
processes don't intefere with each other (e.g. by many processes
trying to modify the same object or use the same resource (e.g. a
file)).  Realy milti-threaded apps in a single memory space (e.g. a
Smalltalk image) are hard.  Avoid if possible.
This won't be a problem, because each instance connection is going to be to a different application running in VisualWorks.

If I'm not wrong, the 'Single Threading' way is a kind of 'safe mode' in which the image works with just one thread and one object can be modified at a specific time line. I need something more powerful than that, I need to restrict the connection to a fixed number.
 
Experiment with the above code fragment to see how it works in practice.

All the best,
   Bruce

I've to say that your example showed me another way [I think] to do what I want to (the 'Single Threading' way is not what I'm looking for, at least for now =).
If I modify the message "HTTPServer>>start",  I can tell the socket to listen just a fixed number of connections at time to only accept a fixed number of users :), which by default says 50.

Thanks a lot,
Lautaro

 

2008/5/30 Lautaro Fernández <[hidden email]>:
> Hello,
> I'm wondering if someone can give me some hints about how to prepare Swazoo
> just for two or maybe three connections at time. I only need so few
> connections because is a personal web server, with some applications around.
> I also need to strip the image to get it as small as possible, anyone have
> done this work before? (I'm developing with VisualWorksNC 7.5)
>
> I'll be grateful for any kind of help.
>
> Thanks in advance,
> Lautaro Fernández
>
> --
> Luke LAut SkyFernadezWalker
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Swazoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swazoo-devel
>
>



--
Make the most of your skills - with OpenSkills
http://www.openskills.org/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swazoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swazoo-devel



--
Luke LAut SkyFernadezWalker
Reply | Threaded
Open this post in threaded view
|

Re: Reduce connections + stripping the image

Bruce Badger
2008/6/2 Lautaro Fernández <[hidden email]>:
> I've to say that your example showed me another way [I think] to do what I
> want to (the 'Single Threading' way is not what I'm looking for, at least
> for now =).
> If I modify the message "HTTPServer>>start",  I can tell the socket to
> listen just a fixed number of connections at time to only accept a fixed
> number of users :), which by default says 50.

Ah, that's the queue size.  In other words, how many HTTP requests can
be sat in the queue not being handled yet before the *operating
system* starts turning them away.

If you do want to have up-to a fixed of requests being handled at the
same time, have a look at the current connections (from memory cos I'm
just about to walk out the door :-)) instance variable.  This contains
all the active connections (i.e. the Smalltalk processes handling
requests) so you may be able to tweak the code based on the size of
this connection ... and this would give you good control over the
maximum number of requests being actively handled at one time.

All the best,
  Bruce

--
Make the most of your skills - with OpenSkills
http://www.openskills.org/