SHARE
TWEET

smartbuild.php

a guest Jan 30th, 2016 9 Never
  1. 11:59:07    czaks   copypaste: i believe the smart_build is now 50% fieldtested :^)
  2. 12:00:36    czaks   the remaining things are to add public_banlist support
  3. 12:00:40    czaks   and, possibly
  4. 12:00:55    czaks   deal with this race condition
  5. 12:01:06    ~copypaste  i don't understand how it works really, and how it is faster than the fascgi thing you already did
  6. 12:01:44    czaks   copypaste: well, it's pretty easy
  7. 12:01:49    czaks   when a rebuild happens
  8. 12:02:03    czaks   instead of rebuilding, we just remove the files we wanted to rebuild
  9. 12:02:06    czaks   no generation happens etc.
  10. 12:02:11    czaks   THEN
  11. 12:02:22    czaks   we install /smart_build.php as a 403 and 404 error handler
  12. 12:02:32    czaks   so if a file doesn't exist yet
  13. 12:02:33    ~copypaste  and that does the generation
  14. 12:02:34    ~copypaste  nice
  15. 12:02:38    czaks   yeah
  16. 12:02:50    ~copypaste  that's very clever actually
  17. 12:03:05    czaks   except that there is a race condition
  18. 12:03:25    czaks   well, not that we didn't have race conditions :^)
  19. 12:03:39    czaks   let's think about two people creating a post at the same time (~1ms)
  20. 12:03:56    czaks   so we actually build the htmls twice
  21. 12:03:57    ~copypaste  lol
  22. 12:04:07    czaks   we have some locking implemented but
  23. 12:04:16    czaks   that's only on write
  24. 12:04:34    czaks   so we waste time and interesting things would happen if the later post gets html
  25. 12:04:38    czaks   instead of the former post
  26. 12:04:44    czaks   this is the current situation
  27. 12:04:57    czaks   with smart build, the htmls are generated on runtime
  28. 12:05:10    czaks   so, well
  29. 12:05:14    czaks   let's suppose i do a post
  30. 12:05:28    czaks   and 1000 people go to see the post at the same time
  31. 12:05:38    czaks   the server now spawns 1000 processes to do the generation
  32. 12:05:40    linear  that's a nice idea yeah.
  33. 12:05:56    czaks   it's easy to fix
  34. 12:06:03    czaks   i have a projected solution
  35. 12:06:14    czaks   but what if
  36. 12:06:29    czaks   1000 people access a post
  37. 12:06:34    czaks   so we do it this way
  38. 12:06:40    czaks   1st person does the generating
  39. 12:06:49    czaks   the rest are waiting for 1st person to generate
  40. 12:06:56    czaks   and are served the page afterwards
  41. 12:07:16    czaks   what if between those situations a new post appears
  42. 12:07:34    czaks   we won't be able to interrupt existing generation
  43. 12:08:09    czaks   but we will be able to interrupt the waiters
  44. 12:08:23    czaks   and the next person who accesses the website does actual generation
  45. 12:09:24    czaks   i will tomorrow think about a solution
  46. 12:09:26    czaks   good night
  47. 12:09:26    czaks   xD
RAW Paste Data
Top