Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

textboards

Name: Anonymous 2007-06-05 17:49 ID:4Zp/Oh3P

I want to make my own textboard in C fastcgi using files instead of a sql database.
Does it sound like a good fast idea?

I just want it to be blazingly fast.

What do you think /prog/?

Name: Anonymous 2007-06-05 17:54 ID:vFwRrJHg

lopl, you got the idea right

Name: Anonymous 2007-06-05 18:07 ID:u59cwM3T

fast? find what works best - SQL isn't bad, especially if you have a small set of servers (such as lighthttpd - I'm sure there are SQL servers of this sort). The primary advantage over a filesystem-based db is that your data is always easy to access and not dependent necessarily on complex directory structures. Also, cahcing is your friend for speed!

Name: Anonymous 2007-06-05 18:09 ID:Heaven

SQL is overkill for a text board.

Name: Anonymous 2007-06-05 18:21 ID:m9P83N0O

Protip: You think using files and directories is great? Think again. First, directories are lists, thus file access is linear with the number of files. Database indexes are trees, thus logarithmic. Second, files seem like the easy thing to use at first. But then you need to implement file locking, and you better come up with a good mechanism. Locking is a standard feature of databases. Some will allow safe reading while you write — even safe writing while you write other rows.

Name: Anonymous 2007-06-05 19:11 ID:qnqx4xmb

Having a database actually simplifies a lot of things. If you want something lightweight it's still better to go with sqlite than flat files.

Although, now that I think about it, with a textboard you only ever really need to append. I guess you could try files, it might work.

Name: Anonymous 2007-06-06 6:34 ID:k2H1dO/B

Use SQLite. Databases are just file libraries, implementing what you would implement by hand if you didn't have them. Most of them work in a client-server fashion, but embedded servers like SQLite work just like any other library, which happens to have a command interface called SQL. SQLite is like 250 KB, blazingly fast, and very easy to use.

Name: Anonymous 2007-06-06 6:50 ID:pwbLLqBE

>>7 speaks the truth. SQLite is very simple yet efficient.

Name: Anonymous 2007-06-06 6:59 ID:gxfhyc/M

The obvious answer is: HAppS

Name: Anonymous 2007-06-06 7:21 ID:ECZkpIP9

BBcode, some duck tape, and a rickrolling is all you need to write a textboard.

Name: Anonymous 2007-06-06 9:00 ID:k2H1dO/B

The obvious answer is: FAppS

Name: Anonymous 2007-06-06 14:34 ID:HkPKCEIl

>First, directories are lists
on FAT32 maybe...

Name: Anonymous 2007-06-07 0:14 ID:Heaven

>>12
So true. Use a real filesystem, get real performance. Use a toy OS with a toy filesystem, get shit performance.

Name: Anonymous 2007-06-07 3:36 ID:6yHe9Pfn

fuck sql and databases, make your own solution it will be 100x faster and more reliable.
people use databases way too much. databases are supposed to be for multiple users to keep concurrency. if you have only one user(the webpage) accessing it, its a waste.

Name: Anonymous 2007-06-07 4:22 ID:FTSaHxQ9

>>14
PROTIP: Most text boards have multiple users who read and post on them.
>>7
SQLite is made of slow and lack of features.

Name: Anonymous 2007-06-07 4:56 ID:afKM4Ap8

>>15
PROTIP: Shiichan uses flat files ;)

Name: Anonymous 2007-06-07 4:57 ID:ziADhn4+

PROTIP: You should store all the data in a single CSV file and fetch it with the Excel COM+ API for maximum ENTERPRISE compliance.

Name: Anonymous 2007-06-07 6:06 ID:Heaven

>>16
PROTIP: Shiichan is shit.

Name: Anonymous 2007-06-07 6:22 ID:iHACr94S

>>18
thread over

Name: Anonymous 2007-06-07 7:19 ID:LIdDO3N4

>>19
Not

Name: Anonymous 2007-06-07 7:50 ID:lnl/3MY2

>>18
PROTIP: both 2ch and Kareha also use flatfiles. Shiichan being shit is unrelated.

Name: Anonymous 2007-06-07 12:56 ID:6yHe9Pfn

>>15
yes i know there are multiple people visiting, but when i say user i mean entities accessing the data. a text board requires just requires one writing "user"(the script that adds a post to the data file) and one reading "user" (the script that writes the page), they reading "user" only has to read once after each write so in effect there is only one "user" and concurrency/locking is irrelevant.

Name: Anonymous 2007-06-07 12:57 ID:4GuhcJds

If your web server is limited to one connection, sure.

Name: Anonymous 2007-06-07 14:32 ID:IAPLDEyn

>>23
shut up

Name: Anonymous 2007-06-07 16:30 ID:NJL3SrSy

>>22
AND THEN TWO PEOPLE POST AT THE SAME TIME AND SHIT FUCKING BLOWS UP.

Name: Anonymous 2007-06-07 17:20 ID:6yHe9Pfn

>>25
the write script queues all the incoming posts and handles them one at a time, there is still only one user accessing the data.

Name: Anonymous 2007-06-07 17:33 ID:wDmTvpTH

>>26
 You moved concurrency handling from the file to the write script! GJ

Name: Anonymous 2007-06-08 1:23 ID:jkBr1q4Q

First, directories are lists, thus file access is linear with the number of files.
lol wut? I wonder if even the first versions of UNIX had this problem.

SQLite is made of slow and lack of features.
From what I've seen, SQLite is a lot faster than other OSS databases for small workloads, which seems to be its niche.

Name: Anonymous 2007-06-08 1:48 ID:RKkZ2Jlj

>>28
Connecting to the database takes longer with SQLite than with MySQL. Maybe if i was doing thousands of SELECTs on every connection that wouldn't matter, but for a simple text board it does end up being pretty significant. Also, lack of features.

Name: Anonymous 2007-06-08 2:12 ID:b+1W54TM

>>30
OP said it'd be a FastCGI program, which means he can just keep the database connection open since the program keeps running between requests; thus, the time it takes to connect is irrelevant. And SQLite has more than enough features for a simple text board.

Name: Anonymous 2007-06-08 3:46 ID:ia8lUjoV

don't bother with files, just limit yourself to one fastcgi process, and keep all the data in memory. maybe have a dump/import so you can shutdown and restart without losing data.

apache's fastcgi stuff should buffer input / output such that you're not waiting around for clients, which means that a simple while(true) { handle_request(); } should perform just as well as multiple processes/threads. unless you have multiple cores, i guess, in which case threads+locking would be the way to go.

you win for lack of filesystem overhead, i would advise you to design your data structures such that paging out to swap will work reasonably well.

inspired by the mailinator implementation - http://mailinator.blogspot.com/2007/01/architecture-of-mailinator.html - even though it's made of threaded jsp fail

Name: Anonymous 2007-06-08 4:32 ID:0ue43rQn

OP here
>>31
you better be joking nigger.

Name: Anonymous 2007-06-08 4:40 ID:b+1W54TM

>>32
It's actually not too bad an idea. If you don't mind the slight risk of total data loss, you could get a massive performance boost.

Name: Anonymous 2007-06-08 6:13 ID:li0J5Z9H

If you don't mind the slight risk of total data loss, you could get a massive performance boost.

VROOM VROOM HAY GENTOO BUDDY

Name: Anonymous 2007-06-08 11:31 ID:7541SlLQ

Maybe you could keep everything in memory for fast searching, but also save a file for each thread in the board. Then, when one of the threads is changed/added to, write that to a new file, delete the old file, and rename the new file to match the name of the old one. This prevents huge read-write times if you have a lot of threads, and also prevents anything from being lost if the system shuts down unexpectedly in a power outage or something. And of course, I reccomend getting saving your files on a bunch of cheap drives in a RAID 5 array.

Also, for searching, how about using merge sort and binary search?

Name: Anonymous 2007-06-08 11:39 ID:GFZdltC7

>>35
Shut up. Open that existing file and try a little something called "appending" to it

Name: Anonymous 2007-06-08 11:54 ID:7541SlLQ

>>36

NEVER SHUT UP, NEVER SURRENDER!

Name: Anonymous 2007-06-08 14:12 ID:CqX9c8Cy

WEB SERVICSE OR GTFO ALSO JAVA ENTERPRISE EDITION APPLICATINO SERVER

Name: Anonymous 2007-06-08 14:18 ID:fsRGI9jv

PROTIP: MOST PEOPLE IN THIS THREAD DON'T KNOW THE DIFFERENCE BETWEEN THREADS AND LIGHTWEIGHT PROCESSES

Name: Anonymous 2007-06-08 14:20 ID:CqX9c8Cy

>>39
PROTIP: NO SUCH DIFFERENCE EXISTS.

Name: Anonymous 2007-06-08 15:30 ID:b+1W54TM

>>40
INCORRECT. A LIGHTWEIGHT PROCESS SHARES ITS RESOURCES WITH ITS PARENT LIKE A THREAD DOES, BUT IS STILL A PROCESS AND IS TREATED AS SUCH BY THE KERNEL, AND THUS HAS A PROCESS ID, AMONG OTHER THINGS.

Name: Anonymous 2007-06-08 16:20 ID:Heaven

PROTIP: MOST PEOPLE IN THIS THREAD DON'T KNOW THE DIFFERENCE BETWEEN A LAME TROLL AND A TYPICAL /PROG/ POST.

Name: Anonymous 2007-06-08 16:33 ID:fsRGI9jv

>>42
PROTIP: NO SUCH DIFFERENCE EXISTS.

Name: Anonymous 2007-06-08 16:58 ID:BbXGf4Xu

PROTIP: MOST PEOPLE IN THIS THREAD ARE NIGGERS

Name: Anonymous 2007-06-08 17:01 ID:CqX9c8Cy

>>43
>>44
PROTIP: YOU GUYS ARE CORRECT,

Name: Anonymous 2007-06-08 17:19 ID:Heaven

>>45
PROTIP: THREAD OVER

Name: Anonymous 2007-06-08 18:04 ID:WmFzj1Jj

>>46
INCORRECT. THREADS IN /prog/ ARE NOT OVER UNTIL THEY REACH ONE THOUSAND POSTS OR UNTIL A BOARD MODERATOR CLOSES THE THREAD.

Name: Anonymous 2007-06-08 18:09 ID:fsRGI9jv

>>43
INCORRECT. LAME TROLLS ARE FAILED ATTEMPTS AT MAKING PEOPLE ANGRY. TYPICAL /PROG POSTS ARE HILARIOUS COMEDY, NOT AIMED AT MAKING PEOPLE ANGRY (EVEN IF THEY INCIDENTALLY DO) BUT AIMED AT EACH OF US' DAILY FIX OF LULZ.

Name: Anonymous 2007-06-08 18:32 ID:LpR98dpP

NO EXCEPTIONS

Name: Anonymous 2007-06-09 0:47 ID:Nb4mwSHi

ITT CRUISE CONTROL

Name: Anonymous 2007-06-09 2:31 ID:Epfk1CIC

ITT FORTRAN PROGRAMMERS

Name: Anonymous 2007-06-09 4:57 ID:Heaven

CAPS LOCK IS CRUISE CONTROL FOR COBOL.

Name: Anonymous 2007-06-09 5:01 ID:kqOrFpQB

ITT HELPFUL PROTIPS

Name: Anonymous 2007-06-09 9:07 ID:60YrCwjm

ITT, CAPS LOCK

Name: Anonymous 2007-06-09 18:52 ID:Nb4mwSHi

ITT NIGGERS

Name: Anonymous 2007-06-09 21:40 ID:Heaven

>>54
ITT COCK
fixed

Name: Anonymous 2007-06-10 4:47 ID:hWvnmFXf

LAPS COCK OR GTFO

Name: Anonymous 2007-06-10 5:06 ID:VvpoIkyV

IF U WERE DROPPED TO /opt TOMORROW, I WOULDNT GO 2 UR DELETION CUZ ID B N UPSTREAM BUGZILLA FLAMIN DA CUNT THAT MADE UR EBUILD!
     __   
   .'  `. 
   |a_a  |
   \<_)__/
   /(   )\
  |\`> < /\
  \_|=='|_/

    WE TRUE NERDS
    WE OPTIMIZE OUR CFLAGS TOGETHER
    WE TALKIN ON IRC WITH www.opera.com TOGETHER
    send this PENGUIN to every thread you care about including this one if you care. C how many times you get this, if you get 256 your A TRUE NERD

Name: Anonymous 2011-02-04 19:32

Name: derp 2013-01-13 14:40

no one answer or generalization is correct, ever.  for some chan sites, text files may be fine.  locking is not an issue, since two people don't need to write to the same file at the same time.  you can make the n+ faggots wait a few milliseconds.  this isn't some payrol application.  you might be surprised to find that they won't actually notice the difference in waiting from their own network latency.  if a {n} lock time passes, then fuck the fucking fuckers.  it is a chan site.  they can repost their faggy post.

Name: derp 2013-01-13 14:46

furthermore, each post within a thread could be a file with a unique extension.  your board software can reassemble them for the blah html output.  this avoids locking if you use {y} digits of microseconds.  these files only need to exist for new posts before the final html is unlocked.  ya you might need to use a filesystem like xfs or ext4 or some random b-tree religious crap.  I use a ram disk, works fine.  my web server uses about 25mb of ram even when half the /b/tards link to it.

Name: Anonymous 2013-01-13 15:56

>>60,61
Let me just hop in my DeoLoerain and tell >>1 what you said

Name: Anonymous 2013-01-13 16:56

>>62
You have a Delorean? Can I get a ride to the grocery store?

Name: derp 2013-01-13 16:59

>>62
thx for the replay.  I answered their question and several of the empty debates.  If you remove all the crap from this thread, it is only a few dozen words.  I have done something similar to what I suggested and it can handle about 90 posts per second, which is 89.9999 more posts per second than most chan boards need.  I bet it would work find on any of 4chans boards.

Name: Anonymous 2013-01-13 17:02

>>64
Thanks for your input. Now kindly return to the imageboards, derp.

Name: Anonymous 2013-01-13 17:16

>>65
>>>>>LE LELLLLLLLLLLLLLLLLLL FACE WHEN
>LLLLLLLLEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>EGIN GIN GIN!!!!!
>EGIN!

Name: derp 2013-01-13 17:19

>>65

I have decided that disdane is the new /b/ and my new internet home, especially since /b/ is exposing ip addresses now.

Name: Anonymous 2013-01-13 17:23

>>67
I don't know what ``disdane'' is, but this isn't the new /b/, and if that's where you are from then you are strongly encouraged to go back.

Name: Anonymous 2013-01-13 17:25

>>67
Where is disdane? This is not disdane. Why are you here?

Name: Anonymous 2013-01-13 17:35

>>67
>TFW LE DISDANE

Name: derp 2013-01-13 19:06

>>69

disdane.4chan.org  it was shortened to dis.  many people mistakenly believe it means discussion.

Name: Anonymous 2013-01-14 6:25

>>71
That is still not this. This is world4ch.

Don't change these.
Name: Email:
Entire Thread Thread List