1

I am new to haskell and yesod. I've follow the quick start guide to install yesod.

But at the 3rd step, when I run stack install yesod-bin cabal-install --install-ghc command, the CPU usage became 100%, and after a while, it throw an error:

~/my-project$ stack install yesod-bin cabal-install --install-ghc
Cabal-1.22.6.0: configure
Progress: 1/108
....
[19 of 79] Compiling Distribution.PackageDescription ( Distribution/PackageDescription.hs, /tmp/stack2919/Cabal-1.22.6.0/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup/Distribution/PackageDescription.o )
    ghc: out of memory (requested 2097152 bytes)

I also find that other program was been killed (a Node.js server)...

Here is my server information:

~/my-project$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 60
Stepping:              1
CPU MHz:               2399.996
BogoMIPS:              4799.99
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
NUMA node0 CPU(s):     0

~/my-project$ free -h
             total       used       free     shared    buffers     cached
Mem:          741M       276M       465M       2.0M       7.2M        68M
-/+ buffers/cache:       201M       540M
Swap:           0B         0B         0B

However, I can not find any hardware in yesod's official website.

Bartek Banachewicz
  • 38,596
  • 7
  • 91
  • 135
user2331095
  • 6,577
  • 8
  • 36
  • 56
  • 4
    I've installed yesod sites with only 128M (on archlinux) and runs fine. But you should upload precompiled binaries to your production machine. Read how to deploy Yesod http://www.yesodweb.com/book/deploying-your-webapp – josejuan Jan 04 '16 at 14:22
  • 3
    Try to add swap space: http://stackoverflow.com/a/13106205/1651941 – Sibi Jan 04 '16 at 14:53
  • @josejuan Is the compile time very long ? I've try the quick start guide on my Macbook air 2013 too. The compile/build time is really long. Is this normal ? – user2331095 Jan 04 '16 at 15:20
  • As Sibi suggests, add swap. The linked answer suggests 1GB of swap, but you might want that to be 2GB. For good measure, chown the swapfile to root and chmod it to 600. As josejuan suggests, in the long run you may want binary deployment simply because it's faster, puts less responsibility on your server nodes making deployment to multiple servers less time-consuming. – sshine Jan 04 '16 at 15:29
  • 1
    I have a (very simple) Yesod server that I both compile and run on a Raspberry Pi B with only 512 M in total. Of course, that's a 32-bit architecture. I definitely needed extra swap for compiling GHC, and I think also for compiling Yesod. The server itself needs 103 MB right now. – leftaroundabout Jan 04 '16 at 16:26
  • @user2331095 yes, compile all needed packages may take long time, stack is other recommended (I love it!) tool that minimize compilation time http://docs.haskellstack.org/en/stable/README.html – josejuan Jan 04 '16 at 16:40

0 Answers0