[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: CPU/Memory limiting

Travis D Warlick Jr

7/8/2007 10:31:00 AM

TongKe Xue wrote:
> I'm working on a massive simulation project (like worldforge). I need to
> be able to allow users to script objects in the world. I am thinking of
> ussing Ruby as my scripting language of choice. However:
>
> (1) I need to be able to limit the memory usage of the object.
> (2) I need to be able to limit the CPU cycle usage of the object.

Try using Process#setrlimit. That being said, and aside from the fact
that I love Ruby -- I don't recommend it for this type of "massive"
endeavor. Always try to choose the best language for your application,
not simply "the best language" because there isn't one.

As for what I would recommend: Not a scripting language. For massive
projects, use a compiled language on the back-end and then you may
integrate it with Ruby on the front-end.

*************************************
* Travis D Warlick, Jr
* Lead Developer
* Operis Systems, LLC
*************************************

4 Answers

M. Edward (Ed) Borasky

7/8/2007 5:41:00 PM

0

Travis D Warlick Jr wrote:
> TongKe Xue wrote:
>> I'm working on a massive simulation project (like worldforge). I need to
>> be able to allow users to script objects in the world. I am thinking of
>> ussing Ruby as my scripting language of choice. However:
>>
>> (1) I need to be able to limit the memory usage of the object.
>> (2) I need to be able to limit the CPU cycle usage of the object.
>
> Try using Process#setrlimit. That being said, and aside from the fact
> that I love Ruby -- I don't recommend it for this type of "massive"
> endeavor. Always try to choose the best language for your application,
> not simply "the best language" because there isn't one.
>
> As for what I would recommend: Not a scripting language. For massive
> projects, use a compiled language on the back-end and then you may
> integrate it with Ruby on the front-end.
>
> *************************************
> * Travis D Warlick, Jr
> * Lead Developer
> * Operis Systems, LLC
> *************************************
>
>
Yes, nearly all of the open-source MMORPG frameworks/games are
implemented in C/C++ and most of them provide some kind of
controlled/controllable scripting capability. I did find *one* that is
Ruby-based (MUES/FaerieMUD) but I was unable to find any evidence that
it is currently active). "daimonin" seemed to be the closest to "baked"
but it is masked in Gentoo because of some outstanding security issues,
so I didn't experiment with it at all.

SonOfLilit

7/8/2007 11:07:00 PM

0

On 7/9/07, TongKe Xue <tongke@gmail.com> wrote:
> I can't use Unix processes because we have too many objects. And we don't
> wnat to pay the >= 8KB kernel memory for each process.
>
> This is for simple stuff like:
>
> dog:
> if dist(owner) > 5
> go_in_direction_of(owner)
>
> but we have crap loads of these objects; and we want them to be user
> scriptable (so C/C++ is a NO NO, we need an interpreted language), but we
> don't want people to do crap like:
>
> while(1) {
> get some more memory;
> }
>
> or
>
> calculate_ditits_of_pi(*)
>
> On 7/8/07, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
> >
> > Travis D Warlick Jr wrote:
> > > TongKe Xue wrote:
> > >> I'm working on a massive simulation project (like worldforge). I need
> > to
> > >> be able to allow users to script objects in the world. I am thinking of
> > >> ussing Ruby as my scripting language of choice. However:
> > >>
> > >> (1) I need to be able to limit the memory usage of the object.
> > >> (2) I need to be able to limit the CPU cycle usage of the object.
> > >
> > > Try using Process#setrlimit. That being said, and aside from the fact
> > > that I love Ruby -- I don't recommend it for this type of "massive"
> > > endeavor. Always try to choose the best language for your application,
> > > not simply "the best language" because there isn't one.
> > >
> > > As for what I would recommend: Not a scripting language. For massive
> > > projects, use a compiled language on the back-end and then you may
> > > integrate it with Ruby on the front-end.
> > >
> > > *************************************
> > > * Travis D Warlick, Jr
> > > * Lead Developer
> > > * Operis Systems, LLC
> > > *************************************
> > >
> > >
> > Yes, nearly all of the open-source MMORPG frameworks/games are
> > implemented in C/C++ and most of them provide some kind of
> > controlled/controllable scripting capability. I did find *one* that is
> > Ruby-based (MUES/FaerieMUD) but I was unable to find any evidence that
> > it is currently active). "daimonin" seemed to be the closest to "baked"
> > but it is masked in Gentoo because of some outstanding security issues,
> > so I didn't experiment with it at all.
> >
> >
>

Smalltalk seems ideal.


Aur

Simen

7/9/2007 12:44:00 AM

0

On 7/9/07, TongKe Xue <tongke@gmail.com> wrote:
> I can't use Unix processes because we have too many objects. And we don't
> wnat to pay the >= 8KB kernel memory for each process.
>
> This is for simple stuff like:
>
> dog:
> if dist(owner) > 5
> go_in_direction_of(owner)
>
> but we have crap loads of these objects; and we want them to be user
> scriptable (so C/C++ is a NO NO, we need an interpreted language), but we
> don't want people to do crap like:
>
> while(1) {
> get some more memory;
> }
>
> or
>
> calculate_ditits_of_pi(*)
>
> On 7/8/07, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
> >
> > Travis D Warlick Jr wrote:
> > > TongKe Xue wrote:
> > >> I'm working on a massive simulation project (like worldforge). I need
> > to
> > >> be able to allow users to script objects in the world. I am thinking of
> > >> ussing Ruby as my scripting language of choice. However:
> > >>
> > >> (1) I need to be able to limit the memory usage of the object.
> > >> (2) I need to be able to limit the CPU cycle usage of the object.
> > >
> > > Try using Process#setrlimit. That being said, and aside from the fact
> > > that I love Ruby -- I don't recommend it for this type of "massive"
> > > endeavor. Always try to choose the best language for your application,
> > > not simply "the best language" because there isn't one.
> > >
> > > As for what I would recommend: Not a scripting language. For massive
> > > projects, use a compiled language on the back-end and then you may
> > > integrate it with Ruby on the front-end.
> > >
> > > *************************************
> > > * Travis D Warlick, Jr
> > > * Lead Developer
> > > * Operis Systems, LLC
> > > *************************************
> > >
> > >
> > Yes, nearly all of the open-source MMORPG frameworks/games are
> > implemented in C/C++ and most of them provide some kind of
> > controlled/controllable scripting capability. I did find *one* that is
> > Ruby-based (MUES/FaerieMUD) but I was unable to find any evidence that
> > it is currently active). "daimonin" seemed to be the closest to "baked"
> > but it is masked in Gentoo because of some outstanding security issues,
> > so I didn't experiment with it at all.
> >
> >
>

Erlang, perhaps. It's got the ability to handle lots and lots of
lightweight threads, at least. Perhaps there's a way to limit the heap
of eachs process, since by design processes don't share data (well,
maybe they do under the hood.) I don't know about embedding it into an
application, though.

--
- Simen

snacktime

7/9/2007 4:31:00 AM

0

I wonder if any of the free ultima online implementations might have
something useful. Been a while but I seem to remember they have a
rather extensive scripting system.

Chris