How to record CPU usage of a single app from top command? - linux

I know 'grep' command can help me do this:
$ top -bd 0.5 -o +%CPU | grep "zoom" > cpu_usage.log
Then I can use another python code to extract the figures but I also want to grab the timestamp from the first line of 'top' result. Is there a way to do it? Thank you so much.

After some research on the internet and reading document (man top / man greb), we can add timestamp by searching for another keyword in the first line which contains its timestamp.
The first lines of top looks like this:
top - 17:05:43 up 11:08, 1 user, load average: 1.16, 1.05, 1.18
Tasks: 294 total, 1 running, 293 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.6 us, 1.9 sy, 0.0 ni, 94.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 7765.0 total, 1048.7 free, 3520.4 used, 3195.9 buff/cache
MiB Swap: 2048.0 total, 1953.7 free, 94.2 used. 3294.5 avail Mem
Notice that the timestamp is the first line and contains "top - ". So I will add another search string "top - " in my command with "\|" between the two search strings signalling the system that I want to get lines that have either/both strings, like this:
$ top -bd 0.5 -o +%CPU | grep "top - \|zoom" > cpu_usage.log
Done!

Related

Monitor Linux process by user or name

i need to get stats from my Centos 6.7 with Cpanel and send to my external monitor server. What I would like to get is an average cpu load per user or per process name in the last 3 minutes. After many research and test not found any praticable solutions apart bash run top with
top -d 180 -b -n 2 > /top.log
second iteration looks like...
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
38017 mysql 20 0 760m 265m 6324 S 1.4 14.2 244:27.08 mysqld
39501 nobody 20 0 1047m 93m 7068 S 0.1 5.0 0:06.80 httpd
54877 johnd 20 0 32728 3612 2364 S 0.0 0.2 0:00.09 imap
51530 johnd 20 0 353m 5372 1928 S 0.0 0.3 0:04.17 php-fpm
39500 nobody 20 0 1046m 79m 3656 S 0.0 4.3 0:02.57 httpd
7 root 20 0 0 0 0 S 0.0 0.0 27:47.61 events/0
39497 nobody 20 0 1046m 84m 7784 S 0.0 4.5 0:02.77 httpd
etc...
then grep (only on the second iteration output) with COMMAND or USER, sum and divide by 100 to get value like cpu-load
echo "$PRTGTOP" | grep johnd | awk '{ sum += $9; } END { print sum/100; }'
I should probably also try to count the process times etc ?, maybe there is a simpler way to achieve the same result, maybe with third-party software to generate stats?
Thanks.
top gets its info from /proc/*/stat. Each numerical directory under /proc is a process number for a currently running process.
It may be easier for you to collect data directly from those directories. The data format is well defined and can be found in man proc under the subsection called "/proc/[pid]/stat".
You can try the pidstat tool (part of the sysstat package):
pidstat -C httpd -U johnd -h -u 180 1 | awk '{ sum += $7; } END { print sum/100;}'
This will return the percentage CPU usage of all processes matching the httpd command string and the johnd user over a 180-second interval.
ok, pidstat is better, thanks!, but if USER pid is run for only few seconds no cpu use is reported. i found best result with:
#run pidstat with 10 iterations for 18 times
pidstat -U -u 10 18 > /pidstat.log
then
#sum all cpu usage and divide by 18
cat /pidstat.log | grep -v Average | grep johnd | awk '{ sum += $8; } END { print sum/100/18;}' OFMT="%3.3f"
cat /pidstat.log | grep -v Average | grep httpd | awk '{ sum += $8; } END { print sum/100/18;}' OFMT="%3.3f"
with this i get best cpu usage stat per USER even if process is run only for few seconds but with high cpu usage

How To Capture Unix 'Top' Command Output to a CSV file?

I am trying to get first 5 lines of top command through shell script & I need to write the output to a csv file ( I need to monitor the result in every 15 seconds ). Finally I need to plot a graph using the obtained datasheet.
I got the shell scrip to write the first 5 lines of top command to a txt file :
#!/bin/bash
echo "execution started.."
top -b -n 3 | sed -n '7,1p' >> out.txt
while [ true ]; do
sleep 15
echo "running.."
top -b -n 3 | sed -n '8, 12p' >> out.txt
done
Here is the out.txt file after few execution :
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3983 arun 20 0 1662480 309580 40936 S 26.3 6.4 13:36.00 gnome-shell
17907 arun 20 0 130020 1680 1172 R 10.5 0.0 0:00.03 top
2016 root 20 0 221792 51172 9636 S 5.3 1.1 4:40.97 Xorg
11917 arun 20 0 7004884 570312 22040 S 5.3 11.7 0:48.83 java
1 root 20 0 59732 7156 3992 S 0.0 0.1 0:02.71 systemd
3983 arun 20 0 1662480 309580 40936 S 36.8 6.4 13:37.23 gnome-shell
2016 root 20 0 221792 51172 9636 S 10.5 1.1 4:41.14 Xorg
2720 mongod 20 0 624364 33716 5200 R 5.3 0.7 1:44.36 mongod
17918 arun 20 0 130020 1676 1172 R 5.3 0.0 0:00.02 top
1 root 20 0 59732 7156 3992 S 0.0 0.1 0:02.71 systemd
3983 arun 20 0 1662480 309580 40936 S 25.0 6.4 13:38.60 gnome-shell
2720 mongod 20 0 624364 33672 5160 S 5.0 0.7 1:44.46 mongod
12081 arun 20 0 2687496 314248 21436 S 5.0 6.5 3:05.51 java
17922 arun 20 0 130020 1680 1172 R 5.0 0.0 0:00.02 top
1 root 20 0 59732 7156 3992 S 0.0 0.1 0:02.71 systemd
But I need the same data in csv format. I have tried to do this by giving output file name as out.csv ! But that didn't work. ( Because it was not in proper format, whole data came within first shell ! )
Can you please provide a solution to write the same output into a csv file ?
If you want to trim runs of whitespace and replace them with commas, try
top -b -n 3 | sed -n '8, 12{s/^ *//;s/ *$//;s/ */,/gp;};12q'
The sed script performs the following substitutions on lines 8 through 12:
Replace any leading space with nothing (otherwise you get an empty first column when the PID is right-aligned).
Replace any trailing spaces with nothing (similarly to avoid empty fields after the data).
Replace any remaining runs of adjacent spaces with a comma. Print this line.
Finally, on line 12, we are done, so we quit sed.
The shell does not pay any attention to the name of the file you are redirecting into and generally, file extensions on Unix are informal decorations, not file type specifiers like they are on some platforms.
You could do echo hello >outputfile.ps and the output would still be text, not PostScript (or a number of other possible interpretations of the .ps file extension). In any event, the echo command does not know that it is being redirected, because that is handled by the shell before the command runs, anyway. (Well, echo is a shell built-in, so in theory there could be some coordination in this case.)

Using GHC's profiling stats/charts to identify trouble-areas / improve performance of Haskell code

TL;DR: Based on the Haskell code and it's associated profiling data below, what conclusions can we draw that let us modify/improve it so we can narrow the performance gap vs. the same algorithm written in imperative languages (namely C++ / Python / C# but the specific language isn't important)?
Background
I wrote the following piece of code as an answer to a question on a popular site which contains many questions of a programming and/or mathematical nature. (You've probably heard of this site, whose name is pronounced "oiler" by some, "yoolurr" by others.) Since the code below is a solution to one of the problems, I'm intentionally avoiding any mention of the site's name or any specific terms in the problem. That said, I'm talking about problem one hundred and three.
(In fact, I've seen many solutions in the site's forums from resident Haskell wizards :P)
Why did I choose to profile this code?
This was the first problem (on said site) in which I encountered a difference in performance (as measured by execution time) between Haskell code vs. C++/Python/C# code (when both use a similar algorithm). In fact, it was the case for all of the problems (thus far; I've done ~100 problems but not sequentially) that an optimized Haskell code was pretty much neck-and-neck with the fastest C++ solutions, ceteris paribus for the algorithm, of course.
However, the posts in the forum for this particular problem would indicate that the same algorithm in these other languages typically require at most one or two seconds, with the longest taking 10-15 sec (assuming the same starting parameters; I'm ignoring the very naive algorithms that take 2-3 min+). In contrast, the Haskell code below required ~50 sec on my (decent) computer (with profiling disabled; with profiling enabled, it takes ~2 min, as you can see below; note: the exec time was identical when compiling with -fllvm). Specs: i5 2.4ghz laptop, 8gb RAM.
In an effort to learn Haskell in a way that it can become a viable substitute to the imperative languages, one of my aims in solving these problems is learning to write code that, to the extent possible, has performance that's on par with those imperative languages. In that context, I still consider the problem as yet unsolved by me (since there's nearly a ~25x difference in performance!)
What have I done so far?
In addition to the obvious step of streamlining the code itself (to the best of my ability), I've also performed the standard profiling exercises that are recommended in "Real World Haskell".
But I'm having a hard time drawing conclusions that that tell me which pieces need to be modified. That's where I'm hoping folks might be able to help provide some guidance.
Description of the problem:
I'd refer you to the website of problem one hundred and three on the aforementioned site but here's a brief summary: the goal is to find a group of seven numbers such that any two disjoint subgroups (of that group) satisfy the following two properties (I'm trying to avoid using the 's-e-t' word for reasons mentioned above...):
no two subgroups sum to the same amount
the subgroup with more elements has a larger sum (in other words, the sum of the smallest four elements must be greater than the sum of the largest three elements).
In particular, we are trying to find the group of seven numbers with the smallest sum.
My (admittedly weak) observations
A warning: some of these comments may well be totally wrong but I wanted to atleast take a stab at interpreting the profiling data based on what I read in Real World Haskell and other profiling-related posts on SO.
There does indeed seem to be an efficiency issue seeing as how one-third of the time is spent doing garbage collection (37.1%). The first table of figures shows that ~172gb is allocated in the heap, which seems horrible... (Maybe there's a better structure / function to use for implementing the dynamic programming solution?)
Not surprisingly, the vast majority (83.1%) of time is spent checking rule 1: (i) 41.6% in the value sub-function, which determines values to fill in the dynamic programming ("DP") table, (ii) 29.1% in the table function, which generates the DP table and (iii) 12.4% in the rule1 function, which checks the resulting DP table to make sure that a given sum can only be calculated in one way (i.e., from one subgroup).
However, I did find it surprising that more time was spent in the value function relative to the table and rule1 functions given that it's the only one of the three which doesn't construct an array or filter through a large number of elements (it's really only performing O(1) lookups and making comparisons between Int types, which you'd think would be relatively quick). So this is a potential problem area. That said, it's unlikely that the value function is driving the high heap-allocation
Frankly, I'm not sure what to make of the three charts.
Heap profile chart (i.e., the first char below):
I'm honestly not sure what is represented by the red area marked as Pinned. It makes sense that the dynamic function has a "spiky" memory allocation because it's called every time the construct function generates a tuple that meets the first three criteria and, each time it's called, it creates a decently large DP array. Also, I'd think that the allocation of memory to store the tuples (generated by construct) wouldn't be flat over the course of the program.
Pending clarification of the "Pinned" red area, I'm not sure this one tells us anything useful.
Allocation by type and allocation by constructor:
I suspect that the ARR_WORDS (which represents a ByteString or unboxed Array according to the GHC docs) represents the low-level execution of the construction of the DP array (in the table function). Nut I'm not 100% sure.
I'm not sure what's the FROZEN and STATIC pointer categories correspond to.
Like I said, I'm really not sure how to interpret the charts as nothing jumps out (to me) as unexpected.
The code and the profiling results
Without further ado, here's the code with comments explaining my algorithm. I've tried to make sure the code doesn't run off of the right-side of the code-box - but some of the comments do require scrolling (sorry).
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wall #-}
import CorePrelude
import Data.Array
import Data.List
import Data.Bool.HT ((?:))
import Control.Monad (guard)
main = print (minimum construct)
cap = 55 :: Int
flr = 20 :: Int
step = 1 :: Int
--we enumerate tuples that are potentially valid and then
--filter for valid ones; we perform the most computationally
--expensive step (i.e., rule 1) at the very end
construct :: [[Int]]
construct = {-# SCC "construct" #-} do
a <- [flr..cap] --1st: we construct potentially valid tuples while applying a
b <- [a+step..cap] --constraint on the upper bound of any element as implied by rule 2
c <- [b+step..a+b-1]
d <- [c+step..a+b-1]
e <- [d+step..a+b-1]
f <- [e+step..a+b-1]
g <- [f+step..a+b-1]
guard (a + b + c + d - e - f - g > 0) --2nd: we screen for tuples that completely conform to rule 2
let nn = [g,f,e,d,c,b,a]
guard (sum nn < 285) --3rd: we screen for tuples of a certain size (a guess to speed things up)
guard (rule1 nn) --4th: we screen for tuples that conform to rule 1
return nn
rule1 :: [Int] -> Bool
rule1 nn = {-# SCC "rule1" #-}
null . filter ((>1) . snd) --confirm that there's only one subgroup that sums to any given sum
. filter ((length nn==) . snd . fst) --the last column us how many subgroups sum to a given sum
. assocs --run the dynamic programming algorithm and generate a table
$ dynamic nn
dynamic :: [Int] -> Array (Int,Int) Int
dynamic ns = {-# SCC "dynamic" #-} table
where
(len, maxSum) = (length &&& sum) ns
table = array ((0,0),(maxSum,len))
[ ((s,i),x) | s <- [0..maxSum], i <- [0..len], let x = value (s,i) ]
elements = listArray (0,len) (0:ns)
value (s,i)
| i == 0 || s == 0 = 0
| s == m = table ! (s,i-1) + 1
| s > m = s <= sum (take i ns) ?:
(table ! (s,i-1) + table ! ((s-m),i-1), 0)
| otherwise = 0
where
m = elements ! i
Stats on heap allocation, garbage collection and time elapsed:
% ghc -O2 --make 103_specialsubset2.hs -rtsopts -prof -auto-all -caf-all -fforce-recomp
[1 of 1] Compiling Main ( 103_specialsubset2.hs, 103_specialsubset2.o )
Linking 103_specialsubset2 ...
% time ./103_specialsubset2.hs +RTS -p -sstderr
zsh: permission denied: ./103_specialsubset2.hs
./103_specialsubset2.hs +RTS -p -sstderr 0.00s user 0.00s system 86% cpu 0.002 total
% time ./103_specialsubset2 +RTS -p -sstderr
SOLUTION REDACTED
172,449,596,840 bytes allocated in the heap
21,738,677,624 bytes copied during GC
261,128 bytes maximum residency (74 sample(s))
55,464 bytes maximum slop
2 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 327548 colls, 0 par 27.34s 41.64s 0.0001s 0.0092s
Gen 1 74 colls, 0 par 0.02s 0.02s 0.0003s 0.0013s
INIT time 0.00s ( 0.01s elapsed)
MUT time 53.91s ( 70.60s elapsed)
GC time 27.35s ( 41.66s elapsed)
RP time 0.00s ( 0.00s elapsed)
PROF time 0.00s ( 0.00s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 81.26s (112.27s elapsed)
%GC time 33.7% (37.1% elapsed)
Alloc rate 3,199,123,974 bytes per MUT second
Productivity 66.3% of total user, 48.0% of total elapsed
./103_specialsubset2 +RTS -p -sstderr 81.26s user 30.90s system 99% cpu 1:52.29 total
Stats on time spent per cost-centre:
Wed Dec 17 23:21 2014 Time and Allocation Profiling Report (Final)
103_specialsubset2 +RTS -p -sstderr -RTS
total time = 15.56 secs (15565 ticks # 1000 us, 1 processor)
total alloc = 118,221,354,488 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
dynamic.value Main 41.6 17.7
dynamic.table Main 29.1 37.8
construct Main 12.9 37.4
rule1 Main 12.4 7.0
dynamic.table.x Main 1.9 0.0
individual inherited
COST CENTRE MODULE no. entries %time %alloc %time %alloc
MAIN MAIN 55 0 0.0 0.0 100.0 100.0
main Main 111 0 0.0 0.0 0.0 0.0
CAF:main1 Main 108 0 0.0 0.0 0.0 0.0
main Main 110 1 0.0 0.0 0.0 0.0
CAF:main2 Main 107 0 0.0 0.0 0.0 0.0
main Main 112 0 0.0 0.0 0.0 0.0
CAF:main3 Main 106 0 0.0 0.0 0.0 0.0
main Main 113 0 0.0 0.0 0.0 0.0
CAF:construct Main 105 0 0.0 0.0 100.0 100.0
construct Main 114 1 0.6 0.0 100.0 100.0
construct Main 115 1 12.9 37.4 99.4 100.0
rule1 Main 123 282235 0.6 0.0 86.5 62.6
rule1 Main 124 282235 12.4 7.0 85.9 62.6
dynamic Main 125 282235 0.2 0.0 73.5 55.6
dynamic.elements Main 133 282235 0.3 0.1 0.3 0.1
dynamic.len Main 129 282235 0.0 0.0 0.0 0.0
dynamic.table Main 128 282235 29.1 37.8 72.9 55.5
dynamic.table.x Main 130 133204473 1.9 0.0 43.8 17.7
dynamic.value Main 131 133204473 41.6 17.7 41.9 17.7
dynamic.value.m Main 132 132640003 0.3 0.0 0.3 0.0
dynamic.maxSum Main 127 282235 0.0 0.0 0.0 0.0
dynamic.(...) Main 126 282235 0.1 0.0 0.1 0.0
dynamic Main 122 282235 0.0 0.0 0.0 0.0
construct.nn Main 121 12683926 0.0 0.0 0.0 0.0
CAF:main4 Main 102 0 0.0 0.0 0.0 0.0
construct Main 116 0 0.0 0.0 0.0 0.0
construct Main 117 0 0.0 0.0 0.0 0.0
CAF:cap Main 101 0 0.0 0.0 0.0 0.0
cap Main 119 1 0.0 0.0 0.0 0.0
CAF:flr Main 100 0 0.0 0.0 0.0 0.0
flr Main 118 1 0.0 0.0 0.0 0.0
CAF:step_r1dD Main 99 0 0.0 0.0 0.0 0.0
step Main 120 1 0.0 0.0 0.0 0.0
CAF GHC.IO.Handle.FD 96 0 0.0 0.0 0.0 0.0
CAF GHC.Conc.Signal 93 0 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding 91 0 0.0 0.0 0.0 0.0
CAF GHC.IO.Encoding.Iconv 82 0 0.0 0.0 0.0 0.0
Heap profile:
Allocation by type:
Allocation by constructors:
There is a lot that can be said. In this answer I'll just comment on the nested list comprehensions in the construct function.
To get an idea on what's going on in construct we'll isolate it and compare it to a nested loop version that you would write in an imperative language. We've removed the rule1 guard to test only the generation of lists.
-- List.hs -- using list comprehensions
import Control.Monad
cap = 55 :: Int
flr = 20 :: Int
step = 1 :: Int
construct :: [[Int]]
construct = do
a <- [flr..cap]
b <- [a+step..cap]
c <- [b+step..a+b-1]
d <- [c+step..a+b-1]
e <- [d+step..a+b-1]
f <- [e+step..a+b-1]
g <- [f+step..a+b-1]
guard (a + b + c + d - e - f - g > 0)
guard (a + b + c + d + e + f + g < 285)
return [g,f,e,d,c,b,a]
-- guard (rule1 nn)
main = do
forM_ construct print
-- Loops.hs -- using imperative looping
import Control.Monad
loop a b f = go a
where go i | i > b = return ()
| otherwise = do f i; go (i+1)
cap = 55 :: Int
flr = 20 :: Int
step = 1 :: Int
main =
loop flr cap $ \a ->
loop (a+step) cap $ \b ->
loop (b+step) (a+b-1) $ \c ->
loop (c+step) (a+b-1) $ \d ->
loop (d+step) (a+b-1) $ \e ->
loop (e+step) (a+b-1) $ \f ->
loop (f+step) (a+b-1) $ \g ->
if (a+b+c+d-e-f-g > 0) && (a+b+c+d+e+f+g < 285)
then print [g,f,e,d,c,b,a]
else return ()
Both programs were compiled with ghc -O2 -rtsopts and run with prog +RTS -s > out.
Here is a summary of the results:
Lists.hs Loops.hs
Heap allocation 44,913 MB 2,740 MB
Max. Residency 44,312 44,312
%GC 5.8 % 1.7 %
Total Time 9.48 secs 1.43 secs
As you can see, the loop version, which is the way you would write this in a language like C,
wins in every category.
The list comprehension version is cleaner and more composable but also less performant than direct iteration.

Avoiding allocations in Haskell

I'm working on a more complicated program I would like to be very efficient, but I have boiled down my concerns for right now to the following simple program:
main :: IO ()
main = print $ foldl (+) 0 [(1::Int)..1000000]
Here I build and run it.
$ uname -s -r -v -m
Linux 3.12.9-x86_64-linode37 #1 SMP Mon Feb 3 10:01:02 EST 2014 x86_64
$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 7.4.1
$ ghc -O -prof --make B.hs
$ ./B +RTS -P
500000500000
$ less B.prof
Sun Feb 16 16:37 2014 Time and Allocation Profiling Report (Final)
B +RTS -P -RTS
total time = 0.04 secs (38 ticks # 1000 us, 1 processor)
total alloc = 80,049,792 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc ticks bytes
CAF Main 100.0 99.9 38 80000528
individual inherited
COST CENTRE MODULE no. entries %time %alloc %time %alloc ticks bytes
MAIN MAIN 44 0 0.0 0.0 100.0 100.0 0 10872
CAF Main 87 0 100.0 99.9 100.0 99.9 38 80000528
CAF GHC.IO.Handle.FD 85 0 0.0 0.0 0.0 0.0 0 34672
CAF GHC.Conc.Signal 83 0 0.0 0.0 0.0 0.0 0 672
CAF GHC.IO.Encoding 76 0 0.0 0.0 0.0 0.0 0 2800
CAF GHC.IO.Encoding.Iconv 60 0 0.0 0.0 0.0 0.0 0 248
It looks like 80 bytes are being allocated per iteration. I think it's quite reasonable to expect the compiler to generate allocation-free code here.
Is my expectation unreasonable? Are the allocations a side effect of enabling profiling? How can I finangle things to get rid of the allocation?
In this case it looks like GHC was smart enough to optimize foldl into the stricter form, but GHC can't optimize away the intermediate list because foldl isn't a good consumer, so presumably those allocations are for the (:) constructors. (EDIT3: No, looks like that's not the case; see comments)
By using foldr fusion kicks in and you can get rid of the intermediate list:
main :: IO ()
main = print $ foldr (+) 0 [(1::Int)..1000000]
...as you can see:
k +RTS -P -RTS
total time = 0.01 secs (10 ticks # 1000 us, 1 processor)
total alloc = 45,144 bytes (excludes profiling overheads)
which has the same memory profile for me as
main = print $ (1784293664 :: Int)
EDIT: In this new version we're trading heap allocation for a bunch of (1 + (2 + (3 +...))) on the stack. To really get a good loop we have to write it by hand like:
main = print $ add 1000000
add :: Int -> Int
add nMax = go 0 1 where
go !acc !n
| n == nMax = acc + n
| otherwise = go (acc+n) (n+1)
showing:
total time = 0.00 secs (0 ticks # 1000 us, 1 processor)
total alloc = 45,144 bytes (excludes profiling overheads)
EDIT2 I haven't gotten to use Gabriel Gonzalez foldl library yet, but it also might be worth playing with for your application.

Sphinx claiming memory is too low and my ids are null

I am trying to index about 3,000 document but here is what I am getting
[root#domU-12-31-39-0A-19-CB data]# /usr/local/sphinx/bin/indexer --all
Sphinx 2.0.4-release (r3135)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/usr/local/sphinx/etc/sphinx.conf'...
indexing index 'catalog'...
WARNING: Attribute count is 0: switching to none docinfo
WARNING: collect_hits: mem_limit=0 kb too low, increasing to 12288 kb
WARNING: source catalog: skipped 3558 document(s) with zero/NULL ids
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.040 sec, 0 bytes/sec, 0.00 docs/sec
total 1 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 5 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
I have it set to rt_mem_limit = 512M why is it telling me I dont have enough memory?
rt_mem_limit != mem_limit - they are different variables - with different purposes.
mem_limit - is the value used by indexer during indexing
http://sphinxsearch.com/docs/current.html#conf-mem-limit
- its in the 'indexer' section of your config file.
You must have it sent too loo. Either just leave it out (to use 32M), or change it to better value.
But you also have no document_ids in your dataset. Check your sql_query actully works.

Resources