Your questions are good, they show you got past the initial steps and
start to understand the higher magic of ape :D
I can understand your concerns, I had the same when I started my
current project. But now I would say: you can stor a hell lot of data
on the server side. It's not CPU/Memory that will make your ape
struggle, it's network bandwidth.
So, anything that you can do to reduce network traffic will make your
life easier if you scale up to several thousand users.
In my current project, a 1:1 chat for users, we first had an
installation, having at peak times ~10K users. We collected join/leave
messages in a associative JS array and sent out "bursts" ever 45
seconds to all users, to minimize network load.
What we ended up doing now (and it turns out to be a much better
solution) is to keep lists on the server who likes to chat with whom
and sending out join/leave only to those interested.
So, clients send their current "chat user list" to the server, the
server keeps track of who's following whom and then sends events only
to the right clients - DRAMATICALLY reducing bandwidth and even CPU,
even though there are a lot of loops invlolved.
BTW, we're only using associative arrays (objects) and loops like
for (u in userlist), no standard arrays, since this seems to be a
better fit for this job.
So, my answer would be: go for it! Store data on the server - but use
it wisely. And make sure to clean up your data when a user leaves!!
What I would do on the server:
var userlist={}; //global list of all known users, that gets filled on
the addUser event
var user={
'login':'asdf'.
'pipe': data.pipe //the unipipe of the user
'property1':'qwer',
'property2':'bar
}
userlist[user.login]=user;
So you have all you need in a neat little array and could even send
messages from the server to the client by using.
userlist['tyler'].pipe.sendRaw('msg',data,opts) //well, I think,
something like that... you need to check the docs
Hope this helps a bit?
FYI:
Reasons for why we use associative arrays:
http://www.xosofox.de/2011/02/js-performance-numbered-array-vs-associative-array/
On 30 Jul., 11:37, Tyler Slater <[email protected]> wrote:
> Sorry for dominating these boards with my questions. I appreciate all
> your help. I hope these questions are good.
> Once I feel versed in APE, I'll try and contribute by updating the
> wiki to clarify these issues for others.
>
> I am wondering about the viability of storing information within the
> the script. I am wondering how much it can take. If I was storing
> 10ish variables for each user (including a couple of objects/arrays
> with 10 elements each) as public and private variables could the
> system handle performing different operations on those variables for
> each user regularly, like searching all the users to see if they have
> a certain property? What if I scaled up to hundreds or even a few
> thousand users at once? Would this be a RAM killer? I'd like some
> feedback. Originally I thought I'd put everything in a database and
> query it all the time, but it would be easier to code, and better for
> various reasons to keep the data live in APE, assuming APE can handle
> it.
>
> Thanks for your input!
>
> Tyler
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/