Twilight Forums

Idle chat for wannabe heroes
It is currently Thu May 23, 2013 7:39 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Tue Nov 06, 2007 2:13 pm 
Offline

Joined: Mon Nov 05, 2007 11:28 am
Posts: 13
It reloads a lot, even when nothing in it has changed altogether, e.g. after a combat round where you didn't get hit, after a non-combat that gives an item/is a choice adventure, etc.
this causes a lot of stress in the server, and maybe it should be tweaked?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 06, 2007 2:27 pm 
Offline

Joined: Mon Nov 05, 2007 3:41 am
Posts: 23
Location: Ireland
Your turn count and time of day still need to go down.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 06, 2007 3:15 pm 
Offline

Joined: Mon Nov 05, 2007 11:28 am
Posts: 13
fsdafs I forgot about that. T_T


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 09, 2007 4:29 am 
Offline

Joined: Wed Nov 07, 2007 7:01 am
Posts: 4
No, you don't need to reload it, you can update that information directly with JavaScript.

Really, the frames should be ditched. They are a horrible hack that screw up all kinds of different things. I guess frames were used because KoL does it that way? Just use a proper page and use Ajax for things like fight turns and chat updates.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 09, 2007 5:16 am 
Offline

Joined: Mon Nov 05, 2007 3:41 am
Posts: 23
Location: Ireland
Ajax will not always improve performance (Page requests still have to be made) and not to mention will probably increase server load (Due to shipping out large javascript files).

I agree with you on updating the side pane directly with javascript though. This would save a database request and a pane reload for every page request.

I assume that what Ryme does is as follows, fight page loads, checks db to see if there are sufficient turns, checks hitpoints, calculates combat, sends checks hp again to see does it need to give a 'dead' message, use a bit of javascript to refresh the char pane.

Now being the fact that all the information that he needs to find is already pulled from the database in the fight script, he might as well update it from there directly rather than causing a page reload and repeating the database queries all over again.

Good Idea!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 09, 2007 10:45 pm 
Offline

Joined: Wed Nov 07, 2007 7:01 am
Posts: 4
oeb wrote:
Ajax will not always improve performance (Page requests still have to be made)


Saying that "page requests still have to be made" oversimplifies things. The important question is how many and of what type. Not all requests are equal. Ajax can completely change the request profile for users, so attempting to divine performance consequences from comparing simple request counts isn't useful.

In any case, I wasn't saying that replacing frames with Ajax would always improve performance. Replacing frames with Ajax would improve quality, and Ajax could be used to improve performance from that point.

oeb wrote:
and not to mention will probably increase server load (Due to shipping out large javascript files).


Firstly, There's no requirement for "huge JavaScript files". The amount of code needed to make Ajax calls is very small, I don't know where this myth that Ajax == huge files came from, but it's just not true. Secondly, these are static files. It's the scripts and database hits that are causing problems for Twilight. Thirdly, these static files can be cached so they are only transmitted once per player at the very most.

Quite frankly, you aren't going to solve 500 and database errors on (what I assume is) a bog-standard cheap shared web host. You don't have the control over the environment that you need. You can optimise certain things to buy you a bit of time, but as soon as you get a few more users, you'll be back to square one. Moving Twilight to a virtual host or dedicated server would mean you could install a reverse proxy, opcode cache, memcached, etc.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 09, 2007 11:01 pm 
Offline
Site Admin
User avatar

Joined: Thu Apr 05, 2007 2:04 pm
Posts: 4192
Bogtha wrote:

Quite frankly, you aren't going to solve 500 and database errors on (what I assume is) a bog-standard cheap shared web host. You don't have the control over the environment that you need.


Actually, I'm already on a dedicated server. A low end one, but yeah. Ajax for the character pane is interesting ... honestly, I haven't spent enough time with it yet (see chat). Among other things, less flickeryness might be nice, though.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 10, 2007 5:13 am 
Offline

Joined: Mon Nov 05, 2007 3:41 am
Posts: 23
Location: Ireland
Sitepoint do a book on javascript that is actually pretty good for getting started with ajax and the like if you have not dabbled with it before.

Quote:
Firstly, There's no requirement for "huge JavaScript files". The amount of code needed to make Ajax calls is very small, I don't know where this myth that Ajax == huge files came from, but it's just not true. Secondly, these are static files. It's the scripts and database hits that are causing problems for Twilight. Thirdly, these static files can be cached so they are only transmitted once per player at the very most.


And all the scripts and the database calls still have to exist, and still have to be called. The point that I was trying to make is that Ajax wont actually fix the problem. You will still need the same the same amount of sql querys (As say the suggestion I used above of using a couple of lines of javascript to upload the left pane rather than a reload) and it still requires a script that will do the same amount of processing (Just have a little less output) every time it is called. With the addition of previously unexisting files.

I agree that my statement regarding 'huge' javascript files was incorrect however.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 10, 2007 2:15 pm 
Offline
User avatar

Joined: Fri Nov 02, 2007 11:23 pm
Posts: 32
I think the only reason I'm noticing the char pane reloading is when it reloads as a 500 error. When these get fixed the character pane reloading probably won't be so much of a problem.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 13, 2007 5:33 am 
Offline

Joined: Wed Nov 07, 2007 7:01 am
Posts: 4
oeb wrote:
And all the scripts and the database calls still have to exist, and still have to be called. The point that I was trying to make is that Ajax wont actually fix the problem. You will still need the same the same amount of sql querys


You're looking at this as if you simply replace all the normal page loads with ajax calls. That isn't the case. Like I said before, ajax can completely change the request profile for users. It's not a straight swap between normal page loads and ajax calls, making a direct comparison oversimplifies things.

To give an example, look at what happens when you change what you are wearing. First you have to view your inventory, so there's a page load which incurs a database read for your inventory. Then you click to change an article of clothing, which sends a request that incurs a database write, and then redisplays your inventory page, which incurs another database read.

The same thing done with ajax, on the other hand, would incur the initial read and the write, but not the second read, as it's unnecessary. If you are changing more than one article of clothing, it adds up. For example to change your outfit to go scuba diving, right now it takes four database reads and three writes. If ajax was used, it would be one database read and three writes. Not to mention the fact that you wouldn't have to wait patiently for the page to update before clicking on the next article of clothing you want to wear.

This extends to many different areas of Twilight. Drinking, using skills, using computers, making stuff with your workbench, welding, etc. There's lots of places where the user submits a request only to be redirected back to the same page, with the only different information being computable from what is already known by the client. Generally, places where that happens are prime candidates for ajax use.

You are right that Ajax is not automatically a performance win, but that doesn't mean it never is, and you can usually find a lot of places in a web application like Twilight where it helps performance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group