Re: Too few memory segments provided exception

Posted by Andra Lungu on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Too-few-memory-segments-provided-exception-tp2176p2180.html

Hi,

I am afraid this is a known issue: http://mail-archives.apache.org/mod_mbox/flink-dev/201503.mbox/%3CCAK5ODX7_-Wxg9pr7CkkkG4CzA+yNCNMvmea5L2i2iZZV=2caig@...%3E

The behavior back then seems to be exactly what Shivani is experiencing at the moment. At that point I remember Fabian suggested to test subsets of the code. The problem is that too many operations are executed: joins, coGroups etc...
However, we are implementing examples and library methods here, so we actually need to test the `entire` functionality.

That issue never got fixed; Someone suggested increasing the memory allocated for tests, but nothing happened as far as I remember :|. Furthermore, I am not sure that this would be the solution because as more and more operators get added, Flink will again run out of memory (we don't know how big this memory fraction should ideally be).

It would be great if we could fix this problem :) Or if we can't, can someone suggest what we should do with such PRs? We certainly cannot merge code with failing tests...

Cheers,
Andra

On Mon, Jul 20, 2015 at 2:23 PM, Shivani Ghatge <[hidden email]> wrote:
Hello Maximilian,

Thanks for the suggestion. I will use it to check the program. But when I am creating a PR for the same implementation with a Test, I am getting the same error even on Travis build. So for that what would be the solution?

Here is my PR https://github.com/apache/flink/pull/923
And here is the Travis build status https://travis-ci.org/apache/flink/builds/71695078

Also on the IDE it is working fine in Collection execution mode.

Thanks and Regards,
Shivani

On Mon, Jul 20, 2015 at 2:14 PM, Maximilian Michels <[hidden email]> wrote:
Hi Shivani,

Flink doesn't have enough memory to perform a hash join. You need to provide Flink with more memory. You can either increase the "taskmanager.heap.mb" config variable or set "taskmanager.memory.fraction" to some value greater than 0.7 and smaller then 1.0. The first config variable allocates more overall memory for Flink; the latter changes the ratio between Flink managed memory (e.g. for hash join) and user memory (for you functions and Gelly's code).

If you run this inside an IDE, the memory is configured automatically and you don't have control over that at the moment. You could, however, start a local cluster (./bin/start-local) after you adjusted your flink-conf.yaml and run your programs against that configured cluster. You can do that either through your IDE using a RemoteEnvironment or by submitting the packaged JAR to the local cluster using the command-line tool (./bin/flink).

Hope that helps.

Cheers,
Max

On Mon, Jul 20, 2015 at 2:04 PM, Shivani Ghatge <[hidden email]> wrote:
Hello,
 I am working on a problem which implements Adamic Adar Algorithm using Gelly.
I am running into this exception for all the Joins (including the one that are part of the reduceOnNeighbors function)

Too few memory segments provided. Hash Join needs at least 33 memory segments.


The problem persists even when I comment out some of the joins.

Even after using edg = edg.join(graph.getEdges(), JoinOperatorBase.JoinHint.BROADCAST_HASH_SECOND).where(0,1).equalTo(0,1).with(new JoinEdge());

as suggested by @AndraLungu the problem persists.

The code is


DataSet<Tuple2<Long, Long>> degrees = graph.getDegrees();

        //get neighbors of each vertex in the HashSet for it's value
        computedNeighbors = graph.reduceOnNeighbors(new GatherNeighbors(), EdgeDirection.ALL);
       
        //get vertices with updated values for the final Graph which will be used to get Adamic Edges
        Vertices = computedNeighbors.join(degrees, JoinOperatorBase.JoinHint.BROADCAST_HASH_FIRST).where(0).equalTo(0).with(new JoinNeighborDegrees());

        Graph<Long, Tuple3<Double, HashSet<Long>, List<Tuple3<Long, Long, Double>>>, Double> updatedGraph =
                Graph.fromDataSet(Vertices, edges, env);
       
        //configure Vertex Centric Iteration
        VertexCentricConfiguration parameters = new VertexCentricConfiguration();

        parameters.setName("Find Adamic Adar Edge Weights");

        parameters.setDirection(EdgeDirection.ALL);
       
        //run Vertex Centric Iteration to get the Adamic Adar Edges into the vertex Value
        updatedGraph = updatedGraph.runVertexCentricIteration(new GetAdamicAdarEdges<Long>(), new NeighborsMessenger<Long>(), 1, parameters);
       
        //Extract Vertices of the updated graph
        DataSet<Vertex<Long, Tuple3<Double, HashSet<Long>, List<Tuple3<Long, Long, Double>>>>> vertices = updatedGraph.getVertices();
       
        //Extract the list of Edges from the vertex values
        DataSet<Tuple3<Long, Long, Double>> edg = vertices.flatMap(new GetAdamicList());
       
        //Partial weights for the edges are added
        edg = edg.groupBy(0,1).reduce(new AdamGroup());

        //Graph is updated with the Adamic Adar Edges
        edg = edg.join(graph.getEdges(), JoinOperatorBase.JoinHint.BROADCAST_HASH_SECOND).where(0,1).equalTo(0,1).with(new JoinEdge());

Any idea how I could tackle this Exception?