Sadda.ru Ironetcart Андроид Ассемблер MASM32 Linux Все статьи Table of Contents


 

Speed of Forum Engine. Files or Database

  Max Petrov December 2014

      This part of the computer, the hard disk, has a smaller speed than the processor. Therefore, the time of execution of any program which makes a little amount of calculations, but which intensively works with the files, is limited not by electronics, it is limited by mechanics. That are the motor and gears of the hard disk.

      The number of requests to the disk is critical. Each request causes the positioning of the hard drive head, because firstly the file should be found, and only after that it can be read. This positioning is the slowest operation, and just the number of requests to the hard disk, ultimately, defines the speed of execution of file-intensive program. The way to optimize file-intensive programs is well known, it is to reduce the number of requests to disk, and to get in each request more information from the disk. In other words, if you read a large file at one time, then parse this file byte by byte on the processor, it will take more less time, then you read the file from the hard disk byte by byte.

      To answer the question what is faster, a forum on flat files or a forum on the database, you need to estimate the number of requests to the hard disk in each of these variants of forum implementation. That forum would be a champion by its speed, which for generation of one page would address the hard disk only one time.

      The database is arranged in such a way that a lot of information is written into one file. This file (table) can be of very big size (gigabytes), so that with each request it becomes unprofitable to read the entire table. Therefore, in databases, it is forcedly used the slow and non-optimal way of reading of the hard disk - at a certain place of the table are written the indexes (addresses) of data and rules for it, the requested data is read by repositioning of the head of the hard drive according to the indexes. To obtain each piece of information from the database, several repositions of the head of hard drive are always needed. The forum database contains several tables, for example, a table with messages and a table with user statistics. In order to extract data and create one post in the form in which it will be transferred to the reader, it may require about a dozen repositions of the head of hard disk.

      It is necessary to remember that the database maintains its own logs, which inevitably multiply the total number of operations with file at each access to the database.

      A forum or a site, which writes the information into flat files (the files are situated directly in the forum folder on the server) can access the hard disk directly. In this case there is no alien's pointers between the scripts and the information on the hard drive. The site on flat files does not cause any excessive redirections on the hard disk. With the rational organization of data storage, the site or the forum on flat files requires about ten times the less number of movements of rocker of hard disk during the return of the pages to users, it also provides about a tenfold advantage in speed, in comparison with sites or forums which use the databases.

      At least, there are three Russian forum engines working on flat files: EXBB (now in utf-8), WR-forum, and forum was made by me - Ironetcart (win-1251).



Table of Contents

Assembler MASM32

      The simplest assembly program (beeper)
      Variables and Data Types of Assembler
      Registers of Processor IA32
      Numerical Systems, conversion of number
      Negative numbers

Other articles

      Frontend protection against Stored XSS Attacks (Javascript kills XSS)
      How to enforce Firefox to update favicon
      How to lock CD autorun in Windows XP
      Javascript Progress Bar for PHP program
      Schultz's tables (Shultzstables.exe)
      Speed of Forum Engine. Files or Database
      The best free programs for reading txt-files on Android smartphones
      Why a stupid forum needs a search option?

     


© Max Petrov При использовании материалов ссылка на sadda.ru обязательна