Site software architecture and plans
From the CouchSurfing Wiki, an informal workspace which anyone can edit.
THIS PAGE IS OUTDATED
This page refers to some coding that needs to be done on the CouchSurfing website
( or some rules and details about how to write code for the website )
In the near future, the site will have a slightly different database and software architecture. This is so we can support (1) fast search, and (2) modular components, as the site grows.
Contents |
OpenID
Already the wiki and wordpress are external applications on separate servers made to look like they are part of couchsurfing. The phone network will be like this as well, and it will only become more common.
We would like to move to OpenID as a single sign-on mechanism across all modules:
- http://www.intertwingly.net/blog/2006/12/28/Unobtrusive-OpenID
- http://www.intertwingly.net/blog/2007/01/03/OpenID-for-non-SuperUsers
forms.lib
Most forms on the site are currently generated by forms.lib, which is defined a function which takes an array and outputs a form. We want to supplement this with an object oriented and more flexible approach like this one:
Database optimizations
ORDER BY rand()
We have an occurance of "ORDER BY rand()" in our code. We want to replace it with something more efficient.
session traffic
We also have a lot of session related traffic. The database receives an update to the session table for every page view involving a logged in user. This is becoming a problem. We need a new way to store sessions. One possibility (see Morgan) is wikipedia:memcached.
Something else we should do is not write the session if it hasn't changed.
Another strategy would be to not store $user in session at all.
Friends of a Friend (foaf)
The foaf calculation in profile.lib, which calculates "how you know" another person (through which friends), is database intensive. We would like to possibly cache this information, and also to turn off display of foaf data when the site is extra busy.
Thomas improved this code a lot. It's much better now.
need to add indexes
SELECT title, teaser, date_time, news_id, announcement, `release`, blog from news WHERE announcement = 'Y' ORDER BY date_time desc limit 2;
maxmind_user_log
maxmind_user_log - change ip to int; use inet_aton(); no fragmentation.
