Home » 2013 » October

Monthly Archives: October 2013

Different between ZRAM and ZSWAP

First answer :

ZRAM is a module of the Linux kernel, previously called “compcache”. ZRAM increases performance by avoiding paging on disk and instead uses a compressed block device in RAM in which paging takes place until it is necessary to use the swap space on the hard disk drive. Since using RAM is faster than using disks, zram allows Linux to make more use of RAM when swapping/paging is required, especially on older computers with less RAM installed.

ZSWAP is a lightweight compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. zswap basically trades CPU cycles for potentially reduced swap I/O. This trade-off can also result in a significant performance improvement if reads from the compressed cache are faster than reads from a swap device.

Second answer :


  • Status: In staging tree (as of 3.7) and looking to move into mainline
  • Implementation: compressed block device, memory is dynamically allocated as data is stored
  • Usage: Configure zram block device as a swap device to eliminate need for physical swap defice or swap file
  • Benefits:
    1. Eliminates need for physical swap device. This beame popular when netbooks first showed up. Zram (then compcache) allowed users to avoid swap shortening the lifespan of SSDs in these memory constrained systems.
    2. A zram block device can be used for other applications other than swap, anything you might use a block device for conceivably.
  • Drawbacks:
    1. Once a page is stored in zram it will remain there until paged in or invalidated. The first pages to be paged out will be the oldest pages (LRU list), these are ‘cold’ pages that are infrequently access. As the system continues to swap it will move on to pages that are warmer (more frequently accessed), these may not be able to be stored because of the swap slots consumed by the cold pages. What zram can not do (compcache had the option to configure a block backing device) is to evict pages out to physical disk. Ideally you want to age data out of the in-kernel compressed swap space out to disk so that you can use kernel memory for caching warm swap pages or free it for more productive use.


  • Status: Posted to LKML on Dec 11th, 2012
  • Implementation: compressed in-kernel cache for swap pages. In-kernel cache is compressed, the compression algorithm is pluggable using the CryptoAPI and the storage for pages is dynamically allocated. Older pages can be evicted to disk making this a sort of write-behind cache.
  • Usage: Cache swap pages destined for regular swap devices (or swap files).
  • Benefits:
    1. Integration with swap code (using Frontswap API) allows zswap to choose to store only pages that compress well and handle memory allocation failures, in those cases pages are sent to the backing swap device.
    2. Oldest pages in the cache are pushed out to backing swap device to make room for newer pages, this solves the LRU inversion problem that a lack of page eviction would present.
  • Drawbacks:
    1. Needs a physical swap device (or swapfile).

Compressing RAM with zRam

A successor to compcache, zram, has been already integrated in the Linux kernel for a while now. This means that no additional compilation nor tweaking is required to benefit from compressing memory on the fly and massively reduced swapping.

As with compache, I wanted to nicely integrate the solution into the Ubuntu Upstart deamon – hence this short article. After a couple of minutes of playing the configuration was ready.

Create file zramswap.conf in /etc/init and put the following content in it.

description "Initializes zram swaping"
start on runlevel [2345]
stop on runlevel [!2345]
pre-start script
# load dependency modules
modprobe zram num_devices=2
# initialize the devices
echo 1073741824 > /sys/block/zram0/disksize
echo 1073741824 > /sys/block/zram1/disksize
# Creating swap filesystems
mkswap /dev/zram0
mkswap /dev/zram1
# Switch the swaps on
swapon -p 5 /dev/zram0
swapon -p 5 /dev/zram1
end script
post-stop script
# Switching off swap
swapoff /dev/zram0
swapoff /dev/zram1
rmmod zram
end script

Now you can start the service with sudo start zramswap (it will be automatically started on after the reboot as well).
You will benefit from 2x1GB swap files, which will be compressed and stored in the RAM. Tested on Ubuntu 13.10.

Add RAM to Ubuntu 13.10+ for free: zRAM

In the mainline generic kernel of Ubuntu, there’s a module called zram. This is a pretty good trick to add additional “free” RAM to your machine without any change: it creates in-memory compressed block for swap, meaning it eats a bit of your CPU but gives you literally more RAM.

If you’re on a VPS for example, having 512 MB RAM, this would actually give you access to 750 MB RAM and would eat just a little CPU from you – I don’t even notice it on the Munin graphs.

To install:

apt-get install zram-config

Make sure it’s started and running:

cat /proc/swaps

If you see something like this

# cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       62712   6804    5
/dev/zram1                              partition       62712   6768    5
/dev/zram2                              partition       62712   6744    5
/dev/zram3                              partition       62712   6768    5

then it’s already running.

Reboot your machine, and voilá. You might even turn your regulat disk-swap off.

ZRAM on Debian/Ubuntu for Memory Overcommitment

In recent Linux releases, it’s available a tiny module called zram, that permits us to create RAM based block devices (named /dev/zramX), which will be kept in memory as compressed data. These ram-based block devices allow very fast I/O, and compression provides a reasonable amounts of memory saving.

We can use it as a drop-in replacement for the well-known tmpfs (used for speeding up compilation tasks or for /tmp), or better as a primary swap device, that will lead to virtually increase memory capacity, at the expense of a slightly increased CPU usage to compress/decompress the swapped data.

Nowadays RAM is very cheap, so why bother with compression? Because there are some situations where you can’t upgrade memory (netbooks) or you want to over-commit real resources (virtualization hosts).

For Ubuntu Precise and later:

Starting with Ubuntu Precise, there is an official upstart script for Ubuntu by Adam Conrad to configure zram in the main repository:

[backup] Tips-tips Menjual

Ini sekedar tips menjual tulisan dari sdr Samurai Jagoan dari copast milist TDA Surabaya. Semoga manfaat.


Malam itu ada sms masuk ke hape saya, setelah saya baca rupanya sms dari seorang kawan senior. Beliau berdomisili di wilayah Maluku utara. Di salah satu pulau yang ada disana.

Dalam smsnya itu beliau bilang sama saya kalo dalam beberapa bulan terakhir ini omset penjualan di tokonya meningkat drastis. Paling dikit 30 unit laptop pasti terjual di tokonya setiap bulan dan itupun belum termasuk penjualan asesoris.

Seru nih, kata saya dalam hati. Trus nggak pake basa basi lagi saya balas sms itu, dalam sms balasan saya langsung bertanya pada beliau gimana cara beliau dalam waktu singkat bisa mendongkrak penjualan di tokonya itu.

Setelah sms yang isinya basa-basi, dan saling memuji akhirnya keluar juga jurus-jurus yang dipake beliau dalam mendongkrak penjualan di took komputernya itu. Berdasarkan yang beliau sampaikan maka saya berusaha menyimpulkan seperti ini:

1. beliau selalu menekankan pada semua karyawannya agar selalu memberikan pelayanan terbaik pada setiap konsumen yang datang, nggak peduli siapapun itu yang datang.

2. jika ada konsumen yang komplain terhadap barang yang sudah di beli di tokonya maka setiap karyawan harus merespon dengan baik dan tetep ramah.

3. jika ada konsumen yang dating lantas minta tukar barang yang sudah di beli di toko itu maka karyawan di haruskan langsung saja menukar sesuai yang diinginkan pembeli tanpa harus mempersulit.

4. beliau memberikan garansi satu tahun full pada hardware dan software yang di beli di tokonya.

(menurut yang beliau sampaikan pada saya dalam smsnya, tujuan utama semua fasilitas itu diberikan pada konsumen agar konsumen bisa datang setiap saat ke tokonya, walaupun nggak beli, walaupun hanya komplain dan service. Sebab dengan datangnya konsumen ke tempatnya maka tokonya selalu tampak ramai, selain itu pula beliau dan karyawannya bisa menawarkan produk-produk lainnya yang ada di tokonya itu pada konsumen yang dating untuk komplain dan service)

5. beliau juga bikin semacam paket hemat untuk berbagai macam transaksi yang bisa dibikinkan paket hemat, misalnya beli laptop+ini+ini+ini, dengan paket hemat maka bisa dikatakan konsumen akan mendapatkan beberapa macam barang dengan hanya menambah sekian rupiah saja. (padahal tujuan beliau adalah agar perputaran barang yang ada di toko saya makin cepat)

6. Beliau juga memberikan fasilitas pada pelanggan atau konsumen yang sudah pernah beli di tokonya walaupun baru sekali beli saja. Konsumen seperti itu berhak mendapatkan potongan harga untuk pembelian berikutnya. Beliau nggak membatasi pembeliannya, apapun juga pasti dapat potongan untuk pembelian berikutnya, baik itu untuk pembelian laptop, komputer bahkan juga untuk asesorisnya.

7. Memanjakan konsumen yang datang ke tokonya, jadi pelanggan itu terkadang berasa langsung kayak teman gitu, beliau membina hubungan emosional dengan pelanggan.

8. Beliau memberlakukan juga semacam sistim memberikan potongan sampai 100 ribu rupiah buat pelanggan yang membelikan sesuatu buat temannya di toko nya itu, atau yang mengajak temannya belanja di toko komputernya.

9. Trus beliau juga berikan hadiah pada pelanggannya.

Sistem pemberian hadianya bisa: Diberikan kepada pembeli terbanyak, maksudnya yang sering belanja di tempat nya, selain yang membeli dengan nominal yang besar. Trus hadiah bisa juga di berikan pada pelanggan yang terbanyak me-referensikan teman-temannya untuk belanja di tempat kami.

Hadiahnya bisa di berikan per periodik, sekitar 6 bulan sekali tapi bisa saja diperpanjang sewaktu-waktu dengan alasan banyak yang minta agar pemberian hadiah itu di perpanjang waktunya.

Nah cara pemberian hadiahnya bener-bener terserah ama cara kita, mau dalam bentuk undian ataupun cara-cara yang lain dan hadiahnya memang kita pilihkan yang menarik dan menggoda konsumen.

Beliau biasanya menyiapkan hadiah berupa televisi, kulkas atau blackberry, bahkan pernah juga beliau dalam sebuah periode menyiapkan sepeda motor buat dijadikan hadiah, pokoknya suka-suka beliau ajalah dalam memberikan hadiah buat pelanggan-pelanggannya.

Tehnologi memang memperpendek jarak, hanya dengan saling berbalas sms dalam waktu sekitar satu jam aja saya sudah belajar banyak dengan beliau.

Yuk belajar terus, tapi langsung di praktekkan setelah mendapatkan ilmu biar gak lupa!!

Walaupun bisnis beliau adalah toko computer dan asesorisnya tapi cara-cara yang beliau lakukan dalam mengolah toko dan konsumen rasanya bisa deh di praktekkan dalam bisnis apapun yang kita jalani.

Selamat mencoba…

Facts about Libya under Gaddafi that you probably did not know about !

Here are some Facts you probably do not know about Libya under Muammar Gaddafi:
• There was  no electricity bills in Libya; electricity is free … for all its citizens.
• There was  no interest on loans, banks in Libya are state-owned and loans given to all its citizens at 0% interest by law.
• If a Libyan is unable to find employment after graduation, the state would  pay the average salary of the profession as if he or she is employed until employment is found.
• Should Libyans want to take up a farming career, they receive farm land, a house, equipment, seed and livestock to kick start their farms –this was all for free.
• Gaddafi carried out the world’s largest irrigation project, known as the Great Man-Made River project, to make water readily available throughout the desert country.
• A home was considered a human right in Libya. (In Qaddafi’s Green Book it states: “The house is a basic need of both the individual and the family, therefore it should not be owned by others.”)
• All newlyweds in Libya would receive 60,000 Dinar (US$ 50,000 ) by the government to buy their first apartment so to help start a family.
• A portion of Libyan oil sales is or was  credited directly to the bank accounts of all Libyan citizens.
• A mother who gives birth to a child would  receive US $5,000.
• When a Libyan buys a car, the government would  subsidizes 50% of the price.
• The price of petrol in Libya was  $0.14 per liter.
• For $ 0.15, a Libyan local could  purchase 40 loaves of bread.
• Education and medical treatments was all  free in Libya. Libya can boast one of the finest health care systems in the Arab and African World. All people have access to doctors, hospitals, clinics and medicines, completely free of charge.
• If Libyans cannot find the education or medical facilities they need in Libya, the government would fund  them to go abroad for it – not only free but they get US $2,300/month accommodation and car allowance.
• 25% of Libyans have a university degree. Before Gaddafi only 25% of Libyans were literate. Today the figure is 87%.
• Libya had  no external debt and its reserves amount to $150 billion – though much of this is now frozen globally.


Gaddafi wrote, “They want to do to Libya what they did to Iraq and what they are itching to do to Iran. They want to take back the oil, which was nationalized by these country’s revolutions. They want to re-establish military bases that were shut down by the revolutions and to install client regimes that will subordinate the country’s wealth and labor to imperialist corporate interests. All else is lies and deception.”


Finally, the gold bullion held by the Libyan Central Bank (March 2011) was among the 25 largest reserves in the world, as reported by the Financial Times, citing the International Monetary Fund. This provided Libya a critical lifeline after billions of Libya’s assets were seized by the United States and the 27 member states of the European Union.


Many believe the NATO-led invasion of Libya was/is about oil and a vast wealth of other natural resources. Yet another critical element that few are aware of is the fact that Gaddafi had planned to introduce a single African currency made from gold. [Of this proposed African currency] Dr James Thring stated, “It’s one of these things that you have to plan almost in secret, because as soon as you say you’re going to change over from the dollar to something else, you’re going to be targeted … There were two conferences on this, in 1986 and 2000, organized by Gaddafi. … Most countries in Africa were keen.” This would have eradicated the US Dollar and Euro as trade currencies for Africa.


Source : http://ireport.cnn.com/docs/DOC-884508


Ini sebagian fakta yg ditulis seorang temen di facebook, kita??? Semoga pemimpin negeri kita, bisa mewujudkan gemah ripah loh jinawi, tapi jok suwe2 dadi presidene. .. mundak nasib’e gak jauh beda dengan pak Harto atau Qaddafi..

  1. Tidak ada tagihan listrik di Libya, listrik gratis untuk semua warga negaranya.
  2. Tidak ada bunga pinjaman, bank-bank di Libya milik negara dan pinjaman yang diberikan untuk semua warga negaranya dengan bunga 0% oleh hukum.
  3. Rumah dianggap sebagai hak asasi tiap warga di Libya. Gaddafi berjanji bahwa orangtuanya tidak akan mendapatkan rumah sampai semua orang di Libya memiliki rumah.  Ayah Gaddafi  telah meninggal saat dia, istri dan ibunya masih hidup di tenda.
  4. Semua pengantin baru di Libya menerima Dinar $ 60.000 (US $50.000) oleh pemerintah untuk membeli apartemen pertama mereka sehingga untuk membantu mengawali kehidupan berkeluarga.
  5. Pendidikan dan perawatan medis gratis di Libya. Sebelum Gaddafi hanya 25% dari Libya yang melek huruf, hari ini sudah mencapai angka 83%.
  6. Jika penduduk Libya ingin mengambil karir pertanian, mereka akan menerima tanah pertanian, rumah pertanian, peralatan, benih dan ternak untuk memulai peternakan mereka – Semuanya gratis.
  7. Jika penduduk Libya tidak menemukan fasilitas pendidikan atau medis yang mereka butuhkan di Libya, pemerintah akan mendanai mereka untuk pergi ke luar negeri untuk itu – tidak hanya gratis tetapi mereka mendapatkan US$ 2, 300/bulan untuk akomodasi dan tunjangan mobil.
  8. Di Libya, jika penduduknya membeli mobil, pemerintah memberikan subsidi 50% dari harga mobil tersebut.
  9. Harga bensin di Libya adalah $ 0. 14 per liter. Kalau di rupiahkan jadi Rp 1.300.-an..
  10. Libya tidak memiliki utang luar negeri dan cadangan devisanya sampai $ 150 miliar ( ini translatenya gak yakin).. hehe
  11. Jika penduduk Libya tidak mampu mendapatkan pekerjaan setelah kelulusan, negara akan
    membayar mereka sesuai rata-rata profesinya, seolah-olah dia bekerja sampai betul-betul menemukan pekerjaannya.
  12.  Sebagian dari penjualan minyak Libya adalah disimpan langsung ke rekening bank semua Warga Libya.
  13. Seorang ibu yang melahirkan seorang anak menerima US $ 5, 000, sekitar Rp 45.000.000,00
  14. 40 roti roti di Libya seharga $ 0,15 ( Rp 1.200,00 saja)
  15. 25% dari penduduk Libya memiliki gelar sarjana.
  16. Qaddafi mengembangkan proyek irigasi terbesar di dunia , yang dikenal sebagai proyek Great Man-Made River , untuk membuat air mudah tersedia di seluruh padang pasir negara tersebut.

From Un-known and unverified souces