Skip to content

Instantly share code, notes, and snippets.

View andreicristianpetcu's full-sized avatar

Andrei Petcu andreicristianpetcu

  • Bucharest, Romania
View GitHub Profile
@ekinertac
ekinertac / nginx.conf
Created May 6, 2013 10:37
nginx: port forwarding
server{
listen 80;
server_name example.com;
access_log /home/path_to_site/access.log;
error_log /home/path_to_site/error.log;
location / {
proxy_pass http://0.0.0.0:8002;
proxy_set_header Host $host;
@audreyt
audreyt / posa.mkdn
Last active October 12, 2021 01:06
EtherCalc Chapter for the upcoming book "The Performance of Open Source Applications" - Draft - comments welcome!

From SocialCalc to EtherCalc

Previously, in The Architecture of Open Source Applications, I described SocialCalc, an in-browser spreadsheet system that replaced the server-centric WikiCalc architecture. SocialCalc performs all of its computations in the browser; it uses the server only for loading and saving spreadsheets.

For the Socialtext team, performance was the primary goal behind SocialCalc's design in 2006. The key observation was this: Client-side computation in JavaScript, while an order of magnitude slower than server-side computation in Perl, was still much faster than the network latency incurred during AJAX roundtrips:


WikiCalc and SocialCalc's performance model

******
def find_in_batches(model)
current_batch, count = 0, model.count
while count > 0 do
model.all.skip(current_batch * 1000).limit(1000).each do |doc|
yield doc
end
count -= 1000
current_batch += 1
end