Search Results

Search found 4547 results on 182 pages for 'haskell io'.

Page 8/182 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Determining cause of high NFS/IO utilization without iotop

    - by Matt
    I have a server that is doing an NFSv4 export for user's home directories. There are roughly 25 users (mostly developers/analysts) and about 40 servers mounting the home directory export. Performance is miserable, with users often seeing multi-second lags for simple commands (like ls, or writing a small text file). Sometimes the home directory mount completely hangs for minutes, with users getting "permission denied" errors. The hardware is a Dell R510 with dual E5620 CPUs and 8 GB RAM. There are eight 15k 2.5” 600 GB drives (Seagate ST3600057SS) configured in hardware RAID-6 with a single hot spare. RAID controller is a Dell PERC H700 w/512MB cache (Linux sees this as a LSI MegaSAS 9260). OS is CentOS 5.6, home directory partition is ext3, with options “rw,data=journal,usrquota”. I have the HW RAID configured to present two virtual disks to the OS: /dev/sda for the OS (boot, root and swap partitions), and /dev/sdb for the home directories. What I find curious, and suspicious, is that the sda device often has very high utilization, even though it only contains the OS. I would expect this virtual drive to be idle almost all the time. The system is not swapping, according to "free" and "vmstat". Why would there be major load on this device? Here is a 30-second snapshot from iostat: Time: 09:37:28 AM Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util sda 0.00 44.09 0.03 107.76 0.13 607.40 11.27 0.89 8.27 7.27 78.35 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda2 0.00 44.09 0.03 107.76 0.13 607.40 11.27 0.89 8.27 7.27 78.35 sdb 0.00 2616.53 0.67 157.88 2.80 11098.83 140.04 8.57 54.08 4.21 66.68 sdb1 0.00 2616.53 0.67 157.88 2.80 11098.83 140.04 8.57 54.08 4.21 66.68 dm-0 0.00 0.00 0.03 151.82 0.13 607.26 8.00 1.25 8.23 5.16 78.35 dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-2 0.00 0.00 0.67 2774.84 2.80 11099.37 8.00 474.30 170.89 0.24 66.84 dm-3 0.00 0.00 0.67 2774.84 2.80 11099.37 8.00 474.30 170.89 0.24 66.84 Looks like iotop is the ideal tool to use to sniff out these kinds of issues. But I'm on CentOS 5.6, which doesn't have a new enough kernel to support that program. I looked at Determining which process is causing heavy disk I/O?, and besides iotop, one of the suggestions said to do a "echo 1 /proc/sys/vm/block_dump". I did that (after directing kernel messages to tempfs). In about 13 minutes I had about 700k reads or writes, roughly half from kjournald and the other half from nfsd: # egrep " kernel: .*(READ|WRITE)" messages | wc -l 768439 # egrep " kernel: kjournald.*(READ|WRITE)" messages | wc -l 403615 # egrep " kernel: nfsd.*(READ|WRITE)" messages | wc -l 314028 For what it's worth, for the last hour, utilization has constantly been over 90% for the home directory drive. My 30-second iostat keeps showing output like this: Time: 09:36:30 PM Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util sda 0.00 6.46 0.20 11.33 0.80 71.71 12.58 0.24 20.53 14.37 16.56 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 sda2 0.00 6.46 0.20 11.33 0.80 71.71 12.58 0.24 20.53 14.37 16.56 sdb 137.29 7.00 549.92 3.80 22817.19 43.19 82.57 3.02 5.45 1.74 96.32 sdb1 137.29 7.00 549.92 3.80 22817.19 43.19 82.57 3.02 5.45 1.74 96.32 dm-0 0.00 0.00 0.20 17.76 0.80 71.04 8.00 0.38 21.21 9.22 16.57 dm-1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 dm-2 0.00 0.00 687.47 10.80 22817.19 43.19 65.48 4.62 6.61 1.43 99.81 dm-3 0.00 0.00 687.47 10.80 22817.19 43.19 65.48 4.62 6.61 1.43 99.82

    Read the article

  • How are lists implemented in Haskell (GHC)?

    - by eman
    I was just curious about some exact implementation details of lists in Haskell (GHC-specific answers are fine)--are they naive linked lists, or do they have any special optimizations? More specifically: Do length and (!!) (for instance) have to iterate through the list? If so, are their values cached in any way (i.e., if I call length twice, will it have to iterate both times)? Does access to the back of the list involve iterating through the whole list? Are infinite lists and list comprehensions memoized? (i.e., for fib = 1:1:zipWith (+) fib (tail fib), will each value be computed recursively, or will it rely on the previous computed value?) Any other interesting implementation details would be much appreciated. Thanks in advance!

    Read the article

  • Haskell Console IO in notepad++

    - by IVlad
    I've recently started to learn Haskell. I have this code module Main where import IO main = do hSetBuffering stdin LineBuffering putStrLn "Please enter your name: " name <- getLine putStrLn ("Hello, " ++ name ++ ", how are you?") I'm using the GHC compiler together with the notepad++ editor. The problem is the interaction goes like this: Process started Vlad Please enter your name: Hello, Vlad, how are you? <<< Process finished. As you can see, output is only written after I input something. This was a bit unexpected, as I was sure the program would first ask for my name, then I'd get to enter it and then it would say hello. Well, that's exactly what happens if I run the exe manually, yet not if I run it with notepad++ and use its console wrapper... How can I make notepad++ display the output when it should, and not all of it just before the program terminates? Is this even possible?

    Read the article

  • ByteStrings in Haskell

    - by Jon
    So i am trying to write a program that can read in a java class file as bytecode. For this i am using Data.Binary and Data.ByteStream. The problem i am having is because im pretty new to Haskell i am having trouble actually using these tools. module Main where import Data.Binary.Get import Data.Word import qualified Data.ByteString.Lazy as S getBinary :: Get Word8 getBinary = do a <- getWord8 return (a) main :: IO () main = do contents <- S.getContents print (getBinary contents) This is what i have come up with so far and i fear that its not really even on the right track. Although i know this question is very general i would appreciate some help with what i should be doing with the reading.

    Read the article

  • Haskell: type inference and function composition

    - by Pillsy
    This question was inspired by this answer to another question, indicating that you can remove every occurrence of an element from a list using a function defined as: removeall = filter . (/=) Working it out with pencil and paper from the types of filter, (/=) and (.), the function has a type of removeall :: (Eq a) => a -> [a] -> [a] which is exactly what you'd expect based on its contract. However, with GHCi 6.6, I get gchi> :t removeall removeall :: Integer -> [Integer] -> [Integer] unless I specify the type explicitly (in which case it works fine). Why is Haskell inferring such a specific type for the function?

    Read the article

  • Haskell simple compilation bug

    - by fmsf
    I'm trying to run this code: let coins = [50, 25, 10, 5, 2,1] let candidate = 11 calculate :: [Int] calculate = [ calculate (x+candidate) | x <- coins, x > candidate] I've read some tutorials, and it worked out ok. I'm trying to solve some small problems to give-me a feel of the language. But I'm stuck at this. test.hs:3:0: parse error (possibly incorrect indentation) Can anyone tell me why? I've started with haskell today so please go easy on the explanations. I've tried to run it like: runghc test.hs ghc test.hs but with: ghci < test.hs it gives this one: <interactive>:1:10: parse error on input `=' Thanks

    Read the article

  • High Load - Low IO - Low CPU usage

    - by devup
    I have a system whose load is rather high. As you can see from the top output below, CPU usage and I/O is negligible: top - 17:31:59 up 4 days, 2:34, 2 users, load average: 1.00, 0.99, 1.00 Tasks: 71 total, 1 running, 70 sleeping, 0 stopped, 0 zombie Cpu(s): 2.0%us, 2.0%sy, 0.0%ni, 95.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 960720k total, 707288k used, 253432k free, 67328k buffers Swap: 2811896k total, 2644k used, 2809252k free, 528928k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 15310 root 20 0 2512 1128 888 R 2.1 0.1 0:00.05 top I would appreciate any assistance with isolating the cause(s) of high load for when I/O and CPU are not factors.

    Read the article

  • Invoke Haskell function with heterogeneous arguments?

    - by thurn
    I'm currently working on a Haskell project which automatically tests some functions based on an XML specification. The XML specification gives the arguments to each function and the expected result that the function will provide (the arguments are of many different types). I know how to extract the function arguments from the XML and parse them using the read function, but I haven't figured out how to invoke the function using the arguments I get out. What I basically want is to read and store the arguments in a heterogeneous list (my current thinking is to use a list of type Data.Dynamic) and then invoke the function, passing this heterogeneous list as its argument list. Is this possible? Modifying the functions under test is not an option.

    Read the article

  • Haskell FlatMap

    - by mvid
    I am a beginner interested in Haskell, and I have been trying to implement the flatmap (=) on my own to better understand it. Currently I have flatmap :: (t -> a) -> [t] -> [a] flatmap _ [] = [] flatmap f (x:xs) = f x : flatmap f xs which implements the "map" part but not the "flat". Most of the modifications I make result in the disheartening and fairly informationless Occurs check: cannot construct the infinite type: a = [a] When generalising the type(s) for `flatmap' error. What am I missing?

    Read the article

  • Improve a haskell script

    - by Hector Villalobos
    I'm a newbie in Haskell and I'd like some opinions about improving this script. This is a code generator and requires a command line argument to generate the sql script. ./GenCode "people name:string age:integer" Code: import Data.List import System.Environment (getArgs) create_table :: String -> String create_table str = "CREATE TABLE " ++ h (words str) where h (x:xs) = let cab = x final = xs in x ++ "( " ++ create_fields xs ++ ")" create_fields (x:xs) = takeWhile (/=':') x ++ type x ++ sig where sig | length xs > 0 = "," ++ create_fields xs | otherwise = " " ++ create_fields xs create_fields [] = "" type x | isInfixOf "string" x = " CHARACTER VARYING" | isInfixOf "integer" x = " INTEGER" | isInfixOf "date" x = " DATE" | isInfixOf "serial" x = " SERIAL" | otherwise = "" main = mainWith where mainWith = do args <- getArgs case args of [] -> putStrLn $ "You need one argument" (x:xs) -> putStrLn $ (create_table x)

    Read the article

  • Haskell Syntax: Parse Error On Input

    - by NuNu
    As part of a mini-haskell compiler that I'm writing, I have a function named app. What I want this function to do is take in these arguments epp (App e1 e2). The first step would be to evaluate e1 recursively (epp e1) and check if the output would be an error. If not then evaluate e2 and then call another function eppVals to evaluate the outputs of the calls on e1 and e2 which I defined as v1 and v2 respectively. epp (App e1 e2) | epp e1 /= Error = eppVals v1 v2 | otherwise = Error where v1 = epp e1 v2 = epp e2 <- parse error on input `=' Logically I believe what I have written so far works but I'm getting a parse error on input = where I stated above. Any idea why? My second try epp :: Exp -> Error Val epp (App e1 e2) = (eppVals v1 v2) where v1 = (epp e1) v2 = (epp e2) But now throws Couldn't match expected type Val with actual type Error Val

    Read the article

  • Splitting lists inside list haskell

    - by user3713267
    Hi I need to split list by an argument in Haskell. I found function like this group :: Int -> [a] -> [[a]] group _ [] = [] group n l | n > 0 = (take n l) : (group n (drop n l)) | otherwise = error "Negative n" But what if lists that I want to divide are contained by another list? For example group 3 [[1,2,3,4,5,6],[2,4,6,8,10,12]] should return [[[1,2,3],[4,5,6]],[[2,4,6],[8,10,12]]] Is there any way to do that ?

    Read the article

  • How to extract terms of specific data constructor from a list in Haskell

    - by finnsson
    A common problem I got in Haskell is to extract all terms in a list belonging to a specific data constructor and I'm wondering if there are any better ways than the way I'm doing it at the moment. Let's say you got data Foo = Bar | Goo , the list foos = [Bar, Goo, Bar, Bar, Goo] and wish to extract all Goos from foos. At the moment I usually do something like goos = [Goo | Goo <- foos] and all is well. The problem is when Goo got a bunch of fields and I'm forced to write something like goos = [Goo a b c d e f | Goo a b c d e f <- foos] which is far from ideal. How you do usually handle this problem?

    Read the article

  • Parallel Haskell in order to find the divisors of a huge number

    - by Dragno
    I have written the following program using Parallel Haskell to find the divisors of 1 billion. import Control.Parallel parfindDivisors :: Integer->[Integer] parfindDivisors n = f1 `par` (f2 `par` (f1 ++ f2)) where f1=filter g [1..(quot n 4)] f2=filter g [(quot n 4)+1..(quot n 2)] g z = n `rem` z == 0 main = print (parfindDivisors 1000000000) I've compiled the program with ghc -rtsopts -threaded findDivisors.hs and I run it with: findDivisors.exe +RTS -s -N2 -RTS I have found a 50% speedup compared to the simple version which is this: findDivisors :: Integer->[Integer] findDivisors n = filter g [1..(quot n 2)] where g z = n `rem` z == 0 My processor is a dual core 2 duo from Intel. I was wondering if there can be any improvement in above code. Because in the statistics that program prints says: Parallel GC work balance: 1.01 (16940708 / 16772868, ideal 2) and SPARKS: 2 (1 converted, 0 overflowed, 0 dud, 0 GC'd, 1 fizzled) What are these converted , overflowed , dud, GC'd, fizzled and how can help to improve the time.

    Read the article

  • Haskell - mapping the odd placed values and the even placed values differently

    - by Abstract
    Hey guys, is there an easy way. To take a list of numbers, say 123456. Then multiply the odd placed by three and the even placed by 1. i.e. (1 * 3) + (2 * 1) + (3 * 3) + (4*1) + (5*3) + (6*1) i was thinking the map function somewhere along the lines. But i don't know how to map *3 to just the odd placed values. Oh and if you could give me the version not in prelude that would be great like the actual function or functions, as if its being imported from an external haskell file Thanks for the help

    Read the article

  • simple putStrLn in Haskell/Yampa with arrows syntax

    - by sisif
    i'm using Haskell with the Yampa FRP library which uses the arrows language extension. how can i do a simple putStrLn in a SF? mySF = proc x -> do y <- identity -< x*x putStrLn "Hello World!" ++ show y returnA -< y the arrow syntax complains about the expression not bein an arrow (of course), but even with arrows i get no output output <- identity -< putStrLn "Hello World!"

    Read the article

  • Haskell: reading multiple command line arguments

    - by Survot
    Hi all, Okay, so I am making a program in Haskell that needs to change certain words based on two command line arguments. I have made the replace function and everything works great, but I am stumped getting it to work with command line arguments. Here is the main code: (replace function not included) main = do text <- getContents (command1:command2:_) <- getArgs putStrLn (replace (read command1) (read command2) text) So for intstance in the terminal I want to be able to type something like: "--- cat textfile.txt | ./replace oldword newword" I know this code is close since I have seen others do it this way. O_o Thanks for any help

    Read the article

  • list permutations in haskell

    - by turingcomplete
    So I'm new to haskell and I've been playing with it for a while now. I want to get my function that outputs all list permutations to work. I have written 2 implementations, one works well, the other is giving me an error. Any help would be awesome. This is the first (working) implementation: permute [] = [[]] permute xs = [y| x <- xs, y <- map (x:) $ permute $ delete x xs] This one is giving me an error: permute [] = [[]] permute xs = map (\x -> map (x:) $ permute $ delete x xs) xs and here's the error message: Occurs check: cannot construct the infinite type: t0 = [t0] Expected type: [t0] Actual type: [[t0]] In the expression: map (x :) $ permute $ delete x xs In the first argument of `map', namely `(\ x -> map (x :) $ permute $ delete x xs)' I'd appreciate if someone could explain why I'm getting this error. Thanks

    Read the article

  • RAID 5 heavy IO hard freezes Ubuntu: Why?

    - by Luke has no name
    I have a software RAID 5 partition on LVM in Ubuntu (desktop, actually, but I'm using it as a server). I have been rsyncing a ton of data to it, and the computer was hard freezing, as in I needed to press "Reset". So I thought it was rsync. But I decided I'd try a dd if=/dev/zero of=/path/to/raid5 and sure enough, the computer locked up. Did an identical dd to a JBOD partition on the same machine, and it didn't crash. Assuming a clean RAID5 partition, tri-core processor 2GB of ram, 6GB swap, what could be causing this?

    Read the article

  • problems with Haskell's Number Types

    - by mindeavor.
    I have the following haskell code: fac n = product [1..n] taylor3s w0 f f' f'' t h = w1 : taylor3s w1 f f' f'' (t+h) h where hp i = h^i / fac i w1 = w0 + (hp 1) * f t w0 + (hp 2) * f' t w0 + (hp 3) * f'' t w0 taylor_results = take 4 $ taylor3s 1 f f' f'' 1 0.25 where f t x = t^4 - 4*x/t f' t x = 4*t^3 - 4*(f t x)/t + 4*x/t^2 f'' t x = 12*t^2 - 4*(f' t x)/t + 8*(f t x)/t^2 - 8*x/t^3 taylor_results is supposed to be a use case of taylor3s. However, there is something wrong with the number type inferencing. When I try to compile, this is the error I get: practice.hs:93:26: Ambiguous type variable `a' in the constraints: `Integral a' arising from a use of `taylor3s' at practice.hs:93:26-51 `Fractional a' arising from a use of `f' at practice.hs:93:37 Possible cause: the monomorphism restriction applied to the following: taylor_results :: [a] (bound at practice.hs:93:0) Probable fix: give these definition(s) an explicit type signature or use -XNoMonomorphismRestriction Can someone help me with understanding what the problem is?

    Read the article

  • Haskell UI framework?

    - by Lance May
    Is there, by chance, and emerging Haskell UI framework for Windows? I recently took up looking over the language, and from what I see, it would be great little "one-off" applications (elaborate scripts). However, without a good UI framework I can't see it getting in under the smoke and mirrors of the more obvious contenders. I've read that there are many frameworks, but none are full-featured. I'm just wondering if this is something that's on the rise, or is it simply too difficult to get enough developers going in the same direction with one?

    Read the article

  • Haskell, list of natural number

    - by Hellnar
    Hello, I am an absolute newbie in Haskell yet trying to understand how it works. I want to write my own lazy list of integers such as [1,2,3,4,5...]. For list of ones I have written ones = 1 : ones and when tried, works fine: *Main> take 10 ones [1,1,1,1,1,1,1,1,1,1] How can I do the same for increasing integers ? I have tried this but it indeed fails: int = 1 : head[ int + 1] And after that how can I make a method that multiplies two streams? such as: mulstream s1 s2 = head[s1] * head[s2] : mulstream [tail s1] [tail s2]

    Read the article

  • Utility to record IO statistics (random/sequential, block sizes, read/write ratio) in Unix

    - by Michael Pearson
    As part of provisioning our new server (see other SF) I'd like to find out the following: ratio of random to sequential reads & writes amount of data read & written at a time (pref in histogram form) I can already figure out our reads/writes on a per-operation and overall data level using iostat & dstat, but I'd like to know more. For example, I'd like to know that we're mostly random 16kb reads, or a lot of sequential 64kb reads with random writes. We're (currently) on an Ubuntu 10.04 VM. Is there a utility that I can run that will record and present this information for me?

    Read the article

  • Haskell: foldl' accumulator parameter

    - by Clinton
    I've been asking a few questions about strictness, but I think I've missed the mark before. Hopefully this is more precise. Lets say we have: n = 1000000 f z = foldl' (\(x1, x2) y -> (x1 + y, y - x2)) z [1..n] Without changing f, what should I set z = ... So that f z does not overflow the stack? (i.e. runs in constant space regardless of the size of n) Its okay if the answer requires GHC extensions. My first thought is to define: g (a1, a2) = (!a1, !a2) and then z = g (0, 0) But I don't think g is valid Haskell.

    Read the article

  • dealing with IO vs pure code in haskell

    - by Drakosha
    I'm writing a shell script (my 1st non-example in haskell) which is supposed to list a directory, get every file size, do some string manipulation (pure code) and then rename some files. I'm not sure what i'm doing wrong, so 2 questions: How should i arrange the code in such program? I have a specific issue, i get the following error, what am i doing wrong? error: Couldn't match expected type [FilePath]' against inferred typeIO [FilePath]' In the second argument of mapM', namelyfileNames' In a stmt of a 'do' expression: files <- (mapM getFileNameAndSize fileNames) In the expression: do { fileNames <- getDirectoryContents; files <- (mapM getFileNameAndSize fileNames); sortBy cmpFilesBySize files } code: getFileNameAndSize fname = do (fname, (withFile fname ReadMode hFileSize)) getFilesWithSizes = do fileNames <- getDirectoryContents files <- (mapM getFileNameAndSize fileNames) sortBy cmpFilesBySize files

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >