473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

running postgresql database from loopback filesystem?

I have virtual hosted users on a server and some of them have a
postgresql database. I'm concerned about the outside possibility that a
user could create an infinite loop and fill up the partition on which
everyone's database resides.

Anyway, it occured to me that I could create a special file for each
database user of limited size, and make a filesystem on top of that
file. The file could be owned by the user. Then, each user could have a
seperate database and that database would be at the location of the
mountpoint of that filesystem.

It seems like a strange thing to do (an understatement, to be sure), but
is there anything wrong with it? Are there performance considerations
when using loopback devices like that? Are there dangers of corruption?
How does journaling (ext3, reiser, etc) work in that regard?

Regards,
Jeff Davis
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
2 2679
Jeff Davis wrote:
Anyway, it occured to me that I could create a special file for each
database user of limited size, and make a filesystem on top of that
file. The file could be owned by the user. Then, each user could have a
seperate database and that database would be at the location of the
mountpoint of that filesystem.

It seems like a strange thing to do (an understatement, to be sure), but
is there anything wrong with it? Are there performance considerations
when using loopback devices like that? Are there dangers of corruption?
How does journaling (ext3, reiser, etc) work in that regard?


My experience is that too many filesystem layers increase the risk of
corruption (by amplifying the effects of bugs, there's nothing
inherently wrong with it). For example, I tried running a loopback
filesystem (both with and without encryption) on top of an XFS partition
over LVM spread over four partitions. I could build the filesystem
(ext2 or ext3) on the loopback filesystem, sync, unmount, (cleanly)
reboot, and mount again and the loopback fsys was always corrupt. On
the other hand, a loopback fsys on top of ext3 without LVM seemed to
work fine, as did loopback over a raw disk partition (only useful for
cryptoloop, obviously).

I have no recent experience with reiserfs, I became an xfs convert long
ago. I also have no experience with a pgsql database specifically on a
loopback filesystem, tho msql (eeew!) and mysql (customer's idea, not
mine) didn't seem to mind. To the process a loopback filesystem *is* a
filesystem, it shouldn't be able to tell the difference.

A journalling filesystem on the underlying partition will treat changes
to the backing file just like changes to any other large file. If the
loop filesys also has a journalling filesystem on it, unless you've
specified an alternate journal location, the journal is written onto the
backing file, and those changes (appearing as changes to a regular file)
are handled by the underlying filesystem. One journaling filesys on top
of another does slow things down more than, say, ext2 over ext3. I'd
hope sync is smart enough to do the loopback before the underlying, but
make sure and cleanly unmount the loopback before the underlying
partition just in case.

Performance is definitely reduced, although not nearly as bad as with
loopback AES encryption. Making the loopback file on a fresh filesystem
helped performance substantially; if your backing file isn't reasonably
contiguous, the thrashing gets to be a bit much.

Are you referring to IP-based virtual hosting? If so, you may wish to
look into linux virtual machines (i.e., kernels run in userspace). It
seems to be more secure than chroot-based virtual hosting (or at least
easier to make secure), although memory consumption is much greater. Of
particular interest to you would be the ability to limit disk usage on a
per-virt basis.

-- Bill
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2

Jeff Davis <jd**********@empires.org> writes:
I have virtual hosted users on a server and some of them have a
postgresql database. I'm concerned about the outside possibility that a
user could create an infinite loop and fill up the partition on which
everyone's database resides.


It seems like the obvious solution would be quotas. You would have to set up
each database as a separate postgres postmaster running under a different uid
though.

--
greg
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Otis Green | last post by:
Vote for or against a new newsgroup proposal. To summarize what you need to do, just send an empty e-mail to postgresql-ballot@netagw.com You will receive a ballot by e-mail. Follow the...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
17
by: Carmen Wai | last post by:
Hello: I would like to know whether there is any different in installing Postgresql on the Linux system with file system of EXT2 or EXT3. I have two machines with idential OS (Red Hat 7.3...
6
by: Karl O. Pinc | last post by:
These seem to work. I'm posting them now before I'm done with them before I start messing them up with specifics to my database. Any comment is welcome. However, I've no intention of publishing...
5
by: Shanmugasundaram Doraisamy | last post by:
Dear Group, We have a java front-end for postgresql 3.4. When we monitor the system usage using top we find couple of postmasters taking up close to 90% of the CPU time in total. I would like to...
1
by: Ennio-Sr | last post by:
Hi all! Testing a script where I need to make sure that postgresql is running before passing a <psql dbasename -c "insert into ..." > instruction I faced this curious behaviour: This is the...
0
by: Christoph Haas | last post by:
Hi, list... I have written an application in Perl some time ago (I was young and needed the money) that parses multiple large text files containing nested data structures and allows the user to...
32
by: David Isaac | last post by:
I have no experience with database applications. This database will likely hold only a few hundred items, including both textfiles and binary files. I would like a pure Python solution to the...
2
by: sangith | last post by:
Hi, I configured a linux machine running Cent OS 5 on it. It gets it's IP address, gateway through DHCP. But I am not able to connect to the internet. So I did a "service network restart". ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.